This is an automated email from the ASF dual-hosted git repository.

shishkovilja pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
     new 946cd02bf70 IGNITE-27824 Add message for marshaling of the GridTopic 
(#13062)
946cd02bf70 is described below

commit 946cd02bf70ef18f13224945a4442e280ac485b2
Author: Dmitry Werner <[email protected]>
AuthorDate: Thu May 21 10:47:21 2026 +0500

    IGNITE-27824 Add message for marshaling of the GridTopic (#13062)
---
 .../ignite/internal/CoreMessagesProvider.java      |   3 +-
 .../java/org/apache/ignite/internal/GridTopic.java | 218 ++-------------------
 .../apache/ignite/internal/GridTopicMessage.java   |  83 ++++++++
 .../managers/communication/GridIoManager.java      |  53 ++---
 .../managers/communication/GridIoMessage.java      |  72 ++-----
 .../communication/GridIoSecurityAwareMessage.java  |   7 +-
 .../deployment/GridDeploymentCommunication.java    |   3 +-
 .../managers/deployment/GridDeploymentRequest.java |  43 ++--
 .../eventstorage/GridEventStorageMessage.java      |  36 ++--
 .../datastreamer/DataStreamProcessor.java          |  11 +-
 .../processors/datastreamer/DataStreamerImpl.java  |   8 +-
 .../datastreamer/DataStreamerRequest.java          |  43 ++--
 .../query/running/RunningQueryManager.java         |   9 +-
 .../main/resources/META-INF/classnames.properties  |   2 -
 .../internal/GridTopicExternalizableSelfTest.java  |  37 +---
 ...loymentRequestOfUnknownClassProcessingTest.java |   3 +-
 .../datastreamer/DataStreamerImplSelfTest.java     |   6 +-
 .../security/IgniteSecurityProcessorTest.java      |   1 -
 .../processors/query/h2/IgniteH2Indexing.java      |   4 +-
 .../processors/query/h2/database/H2TreeIndex.java  |   1 -
 .../query/h2/twostep/GridReduceQueryExecutor.java  |   1 -
 21 files changed, 191 insertions(+), 453 deletions(-)

diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/CoreMessagesProvider.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/CoreMessagesProvider.java
index 28777790e3d..fc9e3e11459 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/CoreMessagesProvider.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/CoreMessagesProvider.java
@@ -357,6 +357,7 @@ public class CoreMessagesProvider extends 
AbstractMarshallableMessageFactoryProv
         withNoSchema(GridCacheVersionEx.class);
         withNoSchema(WALPointer.class);
         withNoSchemaResolvedClassLoader(ObjectData.class);
+        withSchemaResolvedClassLoader(GridTopicMessage.class);
 
         // [5700 - 5900]: Discovery originated messages.
         msgIdx = 5700;
@@ -598,7 +599,7 @@ public class CoreMessagesProvider extends 
AbstractMarshallableMessageFactoryProv
         withNoSchema(NodeIdMessage.class);
         withNoSchema(HandshakeMessage.class);
         withNoSchema(HandshakeWaitMessage.class);
-        withSchema(GridIoMessage.class);
+        withNoSchema(GridIoMessage.class);
         withNoSchema(IgniteIoTestMessage.class);
         withSchema(GridIoUserMessage.class);
         withSchema(GridIoSecurityAwareMessage.class);
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/GridTopic.java 
b/modules/core/src/main/java/org/apache/ignite/internal/GridTopic.java
index 2c9e30b09e6..b02498c6601 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridTopic.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridTopic.java
@@ -23,6 +23,7 @@ import java.io.ObjectInput;
 import java.io.ObjectOutput;
 import java.io.Serializable;
 import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 import java.util.UUID;
 import org.apache.ignite.internal.util.distributed.DistributedProcess;
 import org.apache.ignite.internal.util.typedef.internal.S;
@@ -161,7 +162,7 @@ public enum GridTopic {
     private static final GridTopic[] VALS = values();
 
     /** Default charset to work with strings. */
-    private static final Charset DFLT_CHARSET = Charset.forName("UTF-8");
+    private static final Charset DFLT_CHARSET = StandardCharsets.UTF_8;
 
     /**
      * Efficiently gets enumerated value from its ordinal.
@@ -177,7 +178,7 @@ public enum GridTopic {
      * @param id Topic ID.
      * @return Grid message topic with specified ID.
      */
-    public T1 topic(IgniteUuid id) {
+    public Object topic(IgniteUuid id) {
         return new T1(this, id);
     }
 
@@ -219,16 +220,6 @@ public enum GridTopic {
         return new T6(this, 
UUID.nameUUIDFromBytes(id1.getBytes(DFLT_CHARSET)), id2);
     }
 
-    /**
-     * @param id1 ID1.
-     * @param id2 ID2.
-     * @param id3 ID3.
-     * @return Grid message topic with specified IDs.
-     */
-    public Object topic(String id1, int id2, long id3) {
-        return new T5(this, 
UUID.nameUUIDFromBytes(id1.getBytes(DFLT_CHARSET)), id2, id3);
-    }
-
     /**
      * @param id1 ID1.
      * @param id2 ID2.
@@ -239,19 +230,8 @@ public enum GridTopic {
         return new T4(this, 
UUID.nameUUIDFromBytes(id1.getBytes(DFLT_CHARSET)), id2, id3);
     }
 
-    /**
-     * @param id1 ID1.
-     * @param id2 ID2.
-     * @param id3 ID3.
-     * @param id4 ID4.
-     * @return Grid message topic with specified IDs.
-     */
-    public Object topic(String id1, UUID id2, int id3, long id4) {
-        return new T7(this, 
UUID.nameUUIDFromBytes(id1.getBytes(DFLT_CHARSET)), id2, id3, id4);
-    }
-
     /** */
-    public static class T1 implements Externalizable {
+    private static class T1 implements Externalizable {
         /** */
         private static final long serialVersionUID = 0L;
 
@@ -272,21 +252,11 @@ public enum GridTopic {
          * @param topic Topic.
          * @param id ID.
          */
-        public T1(GridTopic topic, IgniteUuid id) {
+        private T1(GridTopic topic, IgniteUuid id) {
             this.topic = topic;
             this.id = id;
         }
 
-        /** */
-        public GridTopic topic() {
-            return topic;
-        }
-
-        /** */
-        public IgniteUuid id() {
-            return id;
-        }
-
         /** {@inheritDoc} */
         @Override public int hashCode() {
             return topic.ordinal() + id.hashCode();
@@ -379,7 +349,7 @@ public enum GridTopic {
         }
 
         /** {@inheritDoc} */
-        @Override public void readExternal(ObjectInput in) throws IOException, 
ClassNotFoundException {
+        @Override public void readExternal(ObjectInput in) throws IOException {
             topic = fromOrdinal(in.readByte());
             id1 = U.readIgniteUuid(in);
             id2 = U.readUuid(in);
@@ -443,7 +413,7 @@ public enum GridTopic {
         }
 
         /** {@inheritDoc} */
-        @Override public void readExternal(ObjectInput in) throws IOException, 
ClassNotFoundException {
+        @Override public void readExternal(ObjectInput in) throws IOException {
             topic = fromOrdinal(in.readByte());
             id1 = U.readUuid(in);
         }
@@ -495,7 +465,7 @@ public enum GridTopic {
 
         /** {@inheritDoc} */
         @Override public int hashCode() {
-            return topic.ordinal() + id1.hashCode() + id2.hashCode() + 
(int)(id3 ^ (id3 >>> 32));
+            return topic.ordinal() + id1.hashCode() + id2.hashCode() + 
Long.hashCode(id3);
         }
 
         /** {@inheritDoc} */
@@ -518,7 +488,7 @@ public enum GridTopic {
         }
 
         /** {@inheritDoc} */
-        @Override public void readExternal(ObjectInput in) throws IOException, 
ClassNotFoundException {
+        @Override public void readExternal(ObjectInput in) throws IOException {
             topic = fromOrdinal(in.readByte());
             id1 = U.readUuid(in);
             id2 = U.readUuid(in);
@@ -531,83 +501,6 @@ public enum GridTopic {
         }
     }
 
-    /**
-     *
-     */
-    private static class T5 implements Externalizable {
-        /** */
-        private static final long serialVersionUID = 0L;
-
-        /** */
-        private GridTopic topic;
-
-        /** */
-        private UUID id1;
-
-        /** */
-        private int id2;
-
-        /** */
-        private long id3;
-
-        /**
-         * No-arg constructor needed for {@link Serializable}.
-         */
-        public T5() {
-            // No-op.
-        }
-
-        /**
-         * @param topic Topic.
-         * @param id1 ID1.
-         * @param id2 ID2.
-         * @param id3 ID3.
-         */
-        private T5(GridTopic topic, UUID id1, int id2, long id3) {
-            this.topic = topic;
-            this.id1 = id1;
-            this.id2 = id2;
-            this.id3 = id3;
-        }
-
-        /** {@inheritDoc} */
-        @Override public int hashCode() {
-            return topic.ordinal() + id1.hashCode() + id2 + (int)(id3 ^ (id3 
>>> 32));
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean equals(Object obj) {
-            if (obj.getClass() == T5.class) {
-                T5 that = (T5)obj;
-
-                return topic == that.topic && id1.equals(that.id1) && id2 == 
that.id2 && id3 == that.id3;
-            }
-
-            return false;
-        }
-
-        /** {@inheritDoc} */
-        @Override public void writeExternal(ObjectOutput out) throws 
IOException {
-            out.writeByte(topic.ordinal());
-            U.writeUuid(out, id1);
-            out.writeInt(id2);
-            out.writeLong(id3);
-        }
-
-        /** {@inheritDoc} */
-        @Override public void readExternal(ObjectInput in) throws IOException, 
ClassNotFoundException {
-            topic = fromOrdinal(in.readByte());
-            id1 = U.readUuid(in);
-            id2 = in.readInt();
-            id3 = in.readLong();
-        }
-
-        /** {@inheritDoc} */
-        @Override public String toString() {
-            return S.toString(T5.class, this);
-        }
-    }
-
     /**
      *
      */
@@ -644,7 +537,7 @@ public enum GridTopic {
 
         /** {@inheritDoc} */
         @Override public int hashCode() {
-            return topic.ordinal() + id1.hashCode() + (int)(id2 ^ (id2 >>> 
32));
+            return topic.ordinal() + id1.hashCode() + Long.hashCode(id2);
         }
 
         /** {@inheritDoc} */
@@ -666,7 +559,7 @@ public enum GridTopic {
         }
 
         /** {@inheritDoc} */
-        @Override public void readExternal(ObjectInput in) throws IOException, 
ClassNotFoundException {
+        @Override public void readExternal(ObjectInput in) throws IOException {
             topic = fromOrdinal(in.readByte());
             id1 = U.readUuid(in);
             id2 = in.readLong();
@@ -678,91 +571,6 @@ public enum GridTopic {
         }
     }
 
-    /**
-     *
-     */
-    private static class T7 implements Externalizable {
-        /** */
-        private static final long serialVersionUID = 0L;
-
-        /** */
-        private GridTopic topic;
-
-        /** */
-        private UUID id1;
-
-        /** */
-        private UUID id2;
-
-        /** */
-        private int id3;
-
-        /** */
-        private long id4;
-
-        /**
-         * No-arg constructor needed for {@link Serializable}.
-         */
-        public T7() {
-            // No-op.
-        }
-
-        /**
-         * @param topic Topic.
-         * @param id1 ID1.
-         * @param id2 ID2.
-         * @param id3 ID3.
-         * @param id4 ID4.
-         */
-        private T7(GridTopic topic, UUID id1, UUID id2, int id3, long id4) {
-            this.topic = topic;
-            this.id1 = id1;
-            this.id2 = id2;
-            this.id3 = id3;
-            this.id4 = id4;
-        }
-
-        /** {@inheritDoc} */
-        @Override public int hashCode() {
-            return topic.ordinal() + id1.hashCode() + id2.hashCode() + id3 + 
(int)(id4 ^ (id4 >>> 32));
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean equals(Object obj) {
-            if (obj.getClass() == T7.class) {
-                T7 that = (T7)obj;
-
-                return topic == that.topic && id1.equals(that.id1) && 
id2.equals(that.id2) && id3 == that.id3 &&
-                    id4 == that.id4;
-            }
-
-            return false;
-        }
-
-        /** {@inheritDoc} */
-        @Override public void writeExternal(ObjectOutput out) throws 
IOException {
-            out.writeByte(topic.ordinal());
-            U.writeUuid(out, id1);
-            U.writeUuid(out, id2);
-            out.writeInt(id3);
-            out.writeLong(id4);
-        }
-
-        /** {@inheritDoc} */
-        @Override public void readExternal(ObjectInput in) throws IOException, 
ClassNotFoundException {
-            topic = fromOrdinal(in.readByte());
-            id1 = U.readUuid(in);
-            id2 = U.readUuid(in);
-            id3 = in.readInt();
-            id4 = in.readLong();
-        }
-
-        /** {@inheritDoc} */
-        @Override public String toString() {
-            return S.toString(T7.class, this);
-        }
-    }
-
     /**
      *
      */
@@ -799,7 +607,7 @@ public enum GridTopic {
 
         /** {@inheritDoc} */
         @Override public int hashCode() {
-            return topic.ordinal() + id1.hashCode() + (int)(id2 ^ (id2 >>> 
32));
+            return topic.ordinal() + id1.hashCode() + Long.hashCode(id2);
         }
 
         /** {@inheritDoc} */
@@ -821,7 +629,7 @@ public enum GridTopic {
         }
 
         /** {@inheritDoc} */
-        @Override public void readExternal(ObjectInput in) throws IOException, 
ClassNotFoundException {
+        @Override public void readExternal(ObjectInput in) throws IOException {
             topic = fromOrdinal(in.readByte());
             id1 = U.readIgniteUuid(in);
             id2 = in.readLong();
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/GridTopicMessage.java 
b/modules/core/src/main/java/org/apache/ignite/internal/GridTopicMessage.java
new file mode 100644
index 00000000000..2f34b53f273
--- /dev/null
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/GridTopicMessage.java
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal;
+
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.marshaller.Marshaller;
+import org.jetbrains.annotations.Nullable;
+
+/** Message wrapper for grid topic. */
+public class GridTopicMessage implements MarshallableMessage {
+    /** Topic. */
+    private Object topic;
+
+    /** Serialized {@link #topic}. */
+    @Order(0)
+    byte[] topicBytes;
+
+    /** Topic ordinal. */
+    @Order(1)
+    int ord = -1;
+
+    /** Constructor for {@link CoreMessagesProvider}. */
+    public GridTopicMessage() {
+        // No-op.
+    }
+
+    /** Constructor. */
+    public GridTopicMessage(Object topic) {
+        this.topic = topic;
+
+        if (topic instanceof GridTopic)
+            ord = ((Enum<GridTopic>)topic).ordinal();
+    }
+
+    /** @return Topic object or null. */
+    public static @Nullable Object topic(GridTopicMessage msg) {
+        return msg == null ? null : msg.topic;
+    }
+
+    /** @return Topic ordinal. */
+    public static int ordinal(GridTopicMessage msg) {
+        return msg == null ? -1 : msg.ord;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void prepareMarshal(Marshaller marsh) throws 
IgniteCheckedException {
+        if (ord < 0 && topic != null)
+            topicBytes = U.marshal(marsh, topic);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void finishUnmarshal(Marshaller marsh, ClassLoader 
clsLdr) throws IgniteCheckedException {
+        if (ord < 0 && topicBytes != null) {
+            topic = U.unmarshal(marsh, topicBytes, clsLdr);
+
+            topicBytes = null;
+        }
+        else if (ord >= 0)
+            topic = GridTopic.fromOrdinal(ord);
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(GridTopicMessage.class, this);
+    }
+}
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
index 9294efd0153..3acf503561a 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
@@ -1921,10 +1921,7 @@ public class GridIoManager extends 
GridManagerAdapter<CommunicationSpi<Object>>
         if (node == null)
             throw new ClusterTopologyCheckedException("Failed to open a new 
channel to remote node (node left): " + nodeId);
 
-        int topicOrd = topic instanceof GridTopic ? 
((Enum<GridTopic>)topic).ordinal() : -1;
-
         GridIoMessage ioMsg = createGridIoMessage(topic,
-            topicOrd,
             initMsg,
             PUBLIC_POOL,
             false,
@@ -1951,7 +1948,6 @@ public class GridIoManager extends 
GridManagerAdapter<CommunicationSpi<Object>>
     /**
      * @param node Destination node.
      * @param topic Topic to send the message to.
-     * @param topicOrd GridTopic enumeration ordinal.
      * @param msg Message to send.
      * @param plc Type of processing.
      * @param ordered Ordered flag.
@@ -1964,7 +1960,6 @@ public class GridIoManager extends 
GridManagerAdapter<CommunicationSpi<Object>>
     private void send(
         ClusterNode node,
         Object topic,
-        int topicOrd,
         Message msg,
         byte plc,
         boolean ordered,
@@ -1977,12 +1972,11 @@ public class GridIoManager extends 
GridManagerAdapter<CommunicationSpi<Object>>
         assert topic != null;
         assert msg != null;
         assert !async || msg instanceof GridIoUserMessage : msg; // Async 
execution was added only for IgniteMessaging.
-        assert topicOrd >= 0 || !(topic instanceof GridTopic) : msg;
 
         try (TraceSurroundings ignored = support(null)) {
             MTC.span().addLog(() -> "Create communication msg - " + 
traceName(msg));
 
-            GridIoMessage ioMsg = createGridIoMessage(topic, topicOrd, msg, 
plc, ordered, timeout, skipOnTimeout);
+            GridIoMessage ioMsg = createGridIoMessage(topic, msg, plc, 
ordered, timeout, skipOnTimeout);
 
             if (locNodeId.equals(node.id())) {
 
@@ -2037,7 +2031,6 @@ public class GridIoManager extends 
GridManagerAdapter<CommunicationSpi<Object>>
      */
     private @NotNull GridIoMessage createGridIoMessage(
         Object topic,
-        int topicOrd,
         Message msg,
         byte plc,
         boolean ordered,
@@ -2050,10 +2043,10 @@ public class GridIoManager extends 
GridManagerAdapter<CommunicationSpi<Object>>
             if (!ctx.security().isDefaultContext())
                 secSubjId = ctx.security().securityContext().subject().id();
 
-            return new GridIoSecurityAwareMessage(secSubjId, plc, topic, 
topicOrd, msg, ordered, timeout, skipOnTimeout);
+            return new GridIoSecurityAwareMessage(secSubjId, plc, topic, msg, 
ordered, timeout, skipOnTimeout);
         }
 
-        return new GridIoMessage(plc, topic, topicOrd, msg, ordered, timeout, 
skipOnTimeout);
+        return new GridIoMessage(plc, topic, msg, ordered, timeout, 
skipOnTimeout);
     }
 
     /**
@@ -2087,7 +2080,7 @@ public class GridIoManager extends 
GridManagerAdapter<CommunicationSpi<Object>>
         if (node == null)
             throw new ClusterTopologyCheckedException("Failed to send message 
to node (has node left grid?): " + nodeId);
 
-        send(node, topic, topic.ordinal(), msg, plc, false, 0, false, null, 
false);
+        send(node, topic, msg, plc, false, 0, false, null, false);
     }
 
     /**
@@ -2099,7 +2092,7 @@ public class GridIoManager extends 
GridManagerAdapter<CommunicationSpi<Object>>
      */
     public void sendToGridTopic(ClusterNode node, GridTopic topic, Message 
msg, byte plc)
         throws IgniteCheckedException {
-        send(node, topic, topic.ordinal(), msg, plc, false, 0, false, null, 
false);
+        send(node, topic, msg, plc, false, 0, false, null, false);
     }
 
     /**
@@ -2111,33 +2104,19 @@ public class GridIoManager extends 
GridManagerAdapter<CommunicationSpi<Object>>
      */
     public void sendToCustomTopic(ClusterNode node, Object topic, Message msg, 
byte plc)
         throws IgniteCheckedException {
-        send(node, topic, -1, msg, plc, false, 0, false, null, false);
-    }
-
-    /**
-     * @param node Destination node.
-     * @param topic Topic to send the message to.
-     * @param msg Message to send.
-     * @param plc Type of processing.
-     * @param span Current span for tracing.
-     * @throws IgniteCheckedException Thrown in case of any errors.
-     */
-    public void sendToGridTopic(ClusterNode node, GridTopic topic, Message 
msg, byte plc, Span span)
-        throws IgniteCheckedException {
-        send(node, topic, topic.ordinal(), msg, plc, false, 0, false, null, 
false);
+        send(node, topic, msg, plc, false, 0, false, null, false);
     }
 
     /**
      * @param node Destination node.
      * @param topic Topic to send the message to.
-     * @param topicOrd GridTopic enumeration ordinal.
      * @param msg Message to send.
      * @param plc Type of processing.     *
      * @throws IgniteCheckedException Thrown in case of any errors.
      */
-    public void sendGeneric(ClusterNode node, Object topic, int topicOrd, 
Message msg, byte plc)
+    public void sendGeneric(ClusterNode node, Object topic, Message msg, byte 
plc)
         throws IgniteCheckedException {
-        send(node, topic, topicOrd, msg, plc, false, 0, false, null, false);
+        send(node, topic, msg, plc, false, 0, false, null, false);
     }
 
     /**
@@ -2159,7 +2138,7 @@ public class GridIoManager extends 
GridManagerAdapter<CommunicationSpi<Object>>
     ) throws IgniteCheckedException {
         assert timeout > 0 || skipOnTimeout;
 
-        send(node, topic, (byte)-1, msg, plc, true, timeout, skipOnTimeout, 
null, false);
+        send(node, topic, msg, plc, true, timeout, skipOnTimeout, null, false);
     }
 
     /**
@@ -2176,7 +2155,7 @@ public class GridIoManager extends 
GridManagerAdapter<CommunicationSpi<Object>>
         byte plc,
         IgniteInClosure<IgniteException> ackC
     ) throws IgniteCheckedException {
-        send(node, topic, topic.ordinal(), msg, plc, false, 0, false, ackC, 
false);
+        send(node, topic, msg, plc, false, 0, false, ackC, false);
     }
 
     /**
@@ -2203,7 +2182,7 @@ public class GridIoManager extends 
GridManagerAdapter<CommunicationSpi<Object>>
 
         for (ClusterNode node : nodes) {
             try {
-                send(node, topic, topic.ordinal(), msg, plc, true, timeout, 
skipOnTimeout, null, false);
+                send(node, topic, msg, plc, true, timeout, skipOnTimeout, 
null, false);
             }
             catch (IgniteCheckedException e) {
                 if (err == null)
@@ -2234,7 +2213,7 @@ public class GridIoManager extends 
GridManagerAdapter<CommunicationSpi<Object>>
 
         for (ClusterNode node : nodes) {
             try {
-                send(node, topic, topic.ordinal(), msg, plc, false, 0, false, 
null, false);
+                send(node, topic, msg, plc, false, 0, false, null, false);
             }
             catch (IgniteCheckedException e) {
                 if (err == null)
@@ -2269,7 +2248,7 @@ public class GridIoManager extends 
GridManagerAdapter<CommunicationSpi<Object>>
     ) throws IgniteCheckedException {
         assert timeout > 0 || skipOnTimeout;
 
-        send(node, topic, (byte)-1, msg, plc, true, timeout, skipOnTimeout, 
ackC, false);
+        send(node, topic, msg, plc, true, timeout, skipOnTimeout, ackC, false);
     }
 
     /**
@@ -2337,7 +2316,6 @@ public class GridIoManager extends 
GridManagerAdapter<CommunicationSpi<Object>>
         else if (loc) {
             send(F.first(nodes),
                 TOPIC_COMM_USER,
-                TOPIC_COMM_USER.ordinal(),
                 ioMsg,
                 PUBLIC_POOL,
                 false,
@@ -2361,7 +2339,6 @@ public class GridIoManager extends 
GridManagerAdapter<CommunicationSpi<Object>>
             if (locNode != null) {
                 send(locNode,
                     TOPIC_COMM_USER,
-                    TOPIC_COMM_USER.ordinal(),
                     ioMsg,
                     PUBLIC_POOL,
                     false,
@@ -3498,8 +3475,7 @@ public class GridIoManager extends 
GridManagerAdapter<CommunicationSpi<Object>>
         }
 
         /** {@inheritDoc} */
-        @SuppressWarnings({"ConstantConditions"
-        })
+        @SuppressWarnings({"ConstantConditions"})
         @Override public void onMessage(UUID nodeId, Object msg, byte plc) {
             if (!(msg instanceof GridIoUserMessage)) {
                 U.error(log, "Received unknown message (potentially fatal 
problem): " + msg);
@@ -4315,7 +4291,6 @@ public class GridIoManager extends 
GridManagerAdapter<CommunicationSpi<Object>>
                 try {
                     send(snd,
                         TOPIC_COMM_SYSTEM,
-                        TOPIC_COMM_SYSTEM.ordinal(),
                         new TcpInverseConnectionResponseMessage(connIdx),
                         SYSTEM_POOL,
                         false,
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessage.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessage.java
index 49d15ff9ec5..8cc6c106cf2 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessage.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessage.java
@@ -17,25 +17,21 @@
 
 package org.apache.ignite.internal.managers.communication;
 
-import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.internal.ExecutorAwareMessage;
-import org.apache.ignite.internal.GridTopic;
-import org.apache.ignite.internal.MarshallableMessage;
+import org.apache.ignite.internal.GridTopicMessage;
 import org.apache.ignite.internal.Order;
 import org.apache.ignite.internal.processors.cache.GridCacheMessage;
 import org.apache.ignite.internal.processors.datastreamer.DataStreamerRequest;
 import org.apache.ignite.internal.processors.tracing.messages.SpanTransport;
 import org.apache.ignite.internal.util.tostring.GridToStringInclude;
 import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.marshaller.Marshaller;
 import org.apache.ignite.plugin.extensions.communication.Message;
 import org.jetbrains.annotations.Nullable;
 
 /**
  * Wrapper for all grid messages.
  */
-public class GridIoMessage implements MarshallableMessage, SpanTransport {
+public class GridIoMessage implements Message, SpanTransport {
     /** */
     public static final Integer STRIPE_DISABLED_PART = Integer.MIN_VALUE;
 
@@ -43,36 +39,29 @@ public class GridIoMessage implements MarshallableMessage, 
SpanTransport {
     @Order(0)
     byte plc;
 
-    /** Message topic. */
-    @GridToStringInclude
-    private Object topic;
-
-    /** Topic bytes. */
+    /** Topic message. */
     @Order(1)
-    byte[] topicBytes;
-
-    /** Topic ordinal. */
-    @Order(2)
-    int topicOrd = -1;
+    @GridToStringInclude
+    GridTopicMessage topicMsg;
 
     /** Message ordered flag. */
-    @Order(3)
+    @Order(2)
     boolean ordered;
 
     /** Message timeout. */
-    @Order(4)
+    @Order(3)
     long timeout;
 
     /** Whether message can be skipped on timeout. */
-    @Order(5)
+    @Order(4)
     boolean skipOnTimeout;
 
     /** Message. */
-    @Order(6)
+    @Order(5)
     Message msg;
 
     /** Serialized span */
-    @Order(7)
+    @Order(6)
     byte[] span;
 
     /**
@@ -85,7 +74,6 @@ public class GridIoMessage implements MarshallableMessage, 
SpanTransport {
     /**
      * @param plc Policy.
      * @param topic Communication topic.
-     * @param topicOrd Topic ordinal value.
      * @param msg Message.
      * @param ordered Message ordered flag.
      * @param timeout Timeout.
@@ -94,20 +82,17 @@ public class GridIoMessage implements MarshallableMessage, 
SpanTransport {
     public GridIoMessage(
         byte plc,
         Object topic,
-        int topicOrd,
         Message msg,
         boolean ordered,
         long timeout,
         boolean skipOnTimeout
     ) {
         assert topic != null;
-        assert topicOrd <= Byte.MAX_VALUE;
         assert msg != null;
 
         this.plc = plc;
         this.msg = msg;
-        this.topic = topic;
-        this.topicOrd = topicOrd;
+        topicMsg = new GridTopicMessage(topic);
         this.ordered = ordered;
         this.timeout = timeout;
         this.skipOnTimeout = skipOnTimeout;
@@ -116,7 +101,7 @@ public class GridIoMessage implements MarshallableMessage, 
SpanTransport {
     /**
      * @return Policy.
      */
-    public byte policy() {
+    byte policy() {
         return plc;
     }
 
@@ -124,21 +109,14 @@ public class GridIoMessage implements 
MarshallableMessage, SpanTransport {
      * @return Topic.
      */
     Object topic() {
-        return topic;
-    }
-
-    /**
-     * @param topic Topic.
-     */
-    void topic(Object topic) {
-        this.topic = topic;
+        return GridTopicMessage.topic(topicMsg);
     }
 
     /**
      * @return Topic ordinal.
      */
-    public int topicOrdinal() {
-        return topicOrd;
+    int topicOrdinal() {
+        return GridTopicMessage.ordinal(topicMsg);
     }
 
     /**
@@ -165,7 +143,7 @@ public class GridIoMessage implements MarshallableMessage, 
SpanTransport {
     /**
      * @return {@code True} if message is ordered, {@code false} otherwise.
      */
-    public boolean isOrdered() {
+    boolean isOrdered() {
         return ordered;
     }
 
@@ -179,7 +157,6 @@ public class GridIoMessage implements MarshallableMessage, 
SpanTransport {
         throw new AssertionError();
     }
 
-
     /** {@inheritDoc} */
     @Override public void span(byte[] span) {
         this.span = span;
@@ -214,23 +191,6 @@ public class GridIoMessage implements MarshallableMessage, 
SpanTransport {
         return null;
     }
 
-    /** {@inheritDoc} */
-    @Override public void prepareMarshal(Marshaller marsh) throws 
IgniteCheckedException {
-        if (topicOrd < 0 && topic != null)
-            topicBytes = U.marshal(marsh, topic);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void finishUnmarshal(Marshaller marsh, ClassLoader ldr) 
throws IgniteCheckedException {
-        if (topicOrd < 0 && topicBytes != null) {
-            topic = U.unmarshal(marsh, topicBytes, ldr);
-
-            topicBytes = null;
-        }
-        else if (topicOrd >= 0)
-            topic = GridTopic.fromOrdinal(topicOrd);
-    }
-
     /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(GridIoMessage.class, this);
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoSecurityAwareMessage.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoSecurityAwareMessage.java
index 302ed86aac8..d1a6040d3d6 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoSecurityAwareMessage.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoSecurityAwareMessage.java
@@ -40,7 +40,6 @@ public class GridIoSecurityAwareMessage extends GridIoMessage 
{
      * @param secSubjId Security subject ID.
      * @param plc Policy.
      * @param topic Communication topic.
-     * @param topicOrd Topic ordinal value.
      * @param msg Message.
      * @param ordered Message ordered flag.
      * @param timeout Timeout.
@@ -50,13 +49,12 @@ public class GridIoSecurityAwareMessage extends 
GridIoMessage {
         UUID secSubjId,
         byte plc,
         Object topic,
-        int topicOrd,
         Message msg,
         boolean ordered,
         long timeout,
         boolean skipOnTimeout
     ) {
-        super(plc, topic, topicOrd, msg, ordered, timeout, skipOnTimeout);
+        super(plc, topic, msg, ordered, timeout, skipOnTimeout);
 
         this.secSubjId = secSubjId;
     }
@@ -64,8 +62,7 @@ public class GridIoSecurityAwareMessage extends GridIoMessage 
{
     /**
      * @return Security subject ID.
      */
-    public UUID securitySubjectId() {
+    UUID securitySubjectId() {
         return secSubjId;
     }
-
 }
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentCommunication.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentCommunication.java
index f6c8b0c6117..422c15e1190 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentCommunication.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentCommunication.java
@@ -29,7 +29,6 @@ import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.events.DiscoveryEvent;
 import org.apache.ignite.events.Event;
 import org.apache.ignite.internal.GridKernalContext;
-import org.apache.ignite.internal.GridTopic;
 import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
 import org.apache.ignite.internal.managers.communication.GridIoPolicy;
 import org.apache.ignite.internal.managers.communication.GridMessageListener;
@@ -376,7 +375,7 @@ class GridDeploymentCommunication {
                     ", requesters=" + nodeIds + ']');
         }
 
-        GridTopic.T1 resTopic = 
TOPIC_CLASSLOAD.topic(IgniteUuid.fromUuid(ctx.localNodeId()));
+        Object resTopic = 
TOPIC_CLASSLOAD.topic(IgniteUuid.fromUuid(ctx.localNodeId()));
 
         GridDeploymentRequest req = new GridDeploymentRequest(resTopic, 
clsLdrId, rsrcName);
 
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentRequest.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentRequest.java
index e79d6798ef4..a41baab9ef1 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentRequest.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentRequest.java
@@ -19,7 +19,7 @@ package org.apache.ignite.internal.managers.deployment;
 
 import java.util.Collection;
 import java.util.UUID;
-import org.apache.ignite.internal.GridTopic;
+import org.apache.ignite.internal.GridTopicMessage;
 import org.apache.ignite.internal.Order;
 import org.apache.ignite.internal.util.tostring.GridToStringInclude;
 import org.apache.ignite.internal.util.typedef.internal.S;
@@ -31,25 +31,20 @@ import org.jetbrains.annotations.Nullable;
  * Deployment request.
  */
 public class GridDeploymentRequest implements Message {
-    /** Response topic. Response should be sent back to this topic. */
-    /** */
+    /** Response topic message. Response should be sent back to this topic. */
     @Order(0)
-    @Nullable GridTopic topic;
-
-    /** */
-    @Order(1)
-    @Nullable IgniteUuid topicId;
+    @Nullable GridTopicMessage topicMsg;
 
     /** Requested class name. */
-    @Order(2)
+    @Order(1)
     String rsrcName;
 
     /** Class loader ID. */
-    @Order(3)
+    @Order(2)
     @Nullable IgniteUuid ldrId;
 
     /** Nodes participating in request (chain). */
-    @Order(4)
+    @Order(3)
     @GridToStringInclude
     Collection<UUID> nodeIds;
 
@@ -67,9 +62,8 @@ public class GridDeploymentRequest implements Message {
      * @param ldrId Class loader ID.
      * @param rsrcName Resource name that should be found and sent back.
      */
-    GridDeploymentRequest(GridTopic.T1 topic, IgniteUuid ldrId, String 
rsrcName) {
-        this.topic = topic.topic();
-        topicId = topic.id();
+    GridDeploymentRequest(Object topic, IgniteUuid ldrId, String rsrcName) {
+        topicMsg = new GridTopicMessage(topic);
         this.ldrId = ldrId;
         this.rsrcName = rsrcName;
     }
@@ -88,10 +82,8 @@ public class GridDeploymentRequest implements Message {
      *
      * @return Response topic name.
      */
-    @Nullable GridTopic.T1 responseTopic() {
-        assert topic == null && topicId == null || topic != null && topicId != 
null;
-
-        return topic == null ? null : new GridTopic.T1(topic, topicId);
+    @Nullable Object responseTopic() {
+        return GridTopicMessage.topic(topicMsg);
     }
 
     /**
@@ -99,7 +91,7 @@ public class GridDeploymentRequest implements Message {
      *
      * @return Resource or class name.
      */
-    public String resourceName() {
+    String resourceName() {
         return rsrcName;
     }
 
@@ -108,7 +100,7 @@ public class GridDeploymentRequest implements Message {
      *
      * @return Property class loader ID.
      */
-    public @Nullable IgniteUuid classLoaderId() {
+    @Nullable IgniteUuid classLoaderId() {
         return ldrId;
     }
 
@@ -117,17 +109,15 @@ public class GridDeploymentRequest implements Message {
      *
      * @return Property undeploy.
      */
-    public boolean undeploy() {
-        assert topic == null && topicId == null || topic != null && topicId != 
null;
-
-        return topic == null;
+    boolean undeploy() {
+        return topicMsg == null;
     }
 
     /**
      * @return Node IDs chain which is updated as request jumps
      *      from node to node.
      */
-    public Collection<UUID> nodeIds() {
+    Collection<UUID> nodeIds() {
         return nodeIds;
     }
 
@@ -135,11 +125,10 @@ public class GridDeploymentRequest implements Message {
      * @param nodeIds Node IDs chain which is updated as request jumps
      *      from node to node.
      */
-    public void nodeIds(Collection<UUID> nodeIds) {
+    void nodeIds(Collection<UUID> nodeIds) {
         this.nodeIds = nodeIds;
     }
 
-
     /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(GridDeploymentRequest.class, this);
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageMessage.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageMessage.java
index d52c640e69c..688145e87b9 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageMessage.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageMessage.java
@@ -24,6 +24,7 @@ import java.util.UUID;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.configuration.DeploymentMode;
 import org.apache.ignite.events.Event;
+import org.apache.ignite.internal.GridTopicMessage;
 import org.apache.ignite.internal.MarshallableMessage;
 import org.apache.ignite.internal.Order;
 import org.apache.ignite.internal.managers.communication.ErrorMessage;
@@ -39,12 +40,9 @@ import org.jetbrains.annotations.Nullable;
  * Event storage message.
  */
 public class GridEventStorageMessage implements MarshallableMessage {
-    /** */
-    private Object resTopic;
-
     /** */
     @Order(0)
-    byte[] resTopicBytes;
+    GridTopicMessage resTopicMsg;
 
     /** */
     private IgnitePredicate<?> filter;
@@ -91,7 +89,7 @@ public class GridEventStorageMessage implements 
MarshallableMessage {
     }
 
     /**
-     * @param resTopic Response topic,
+     * @param resTopic Response topic.
      * @param filter Query filter.
      * @param clsLdrId Class loader ID.
      * @param depMode Deployment mode.
@@ -105,7 +103,7 @@ public class GridEventStorageMessage implements 
MarshallableMessage {
         DeploymentMode depMode,
         String userVer,
         Map<UUID, IgniteUuid> ldrParties) {
-        this.resTopic = resTopic;
+        resTopicMsg = new GridTopicMessage(resTopic);
         this.filter = filter;
         filterClsName = filter.getClass().getName();
         this.depMode = depMode;
@@ -127,7 +125,7 @@ public class GridEventStorageMessage implements 
MarshallableMessage {
         if (ex != null)
             errMsg = new ErrorMessage(ex);
 
-        resTopic = null;
+        resTopicMsg = null;
         filter = null;
         filterClsName = null;
         depMode = null;
@@ -139,13 +137,13 @@ public class GridEventStorageMessage implements 
MarshallableMessage {
      * @return Response topic.
      */
     Object responseTopic() {
-        return resTopic;
+        return GridTopicMessage.topic(resTopicMsg);
     }
 
     /**
      * @return Filter.
      */
-    public IgnitePredicate<?> filter() {
+    IgnitePredicate<?> filter() {
         return filter;
     }
 
@@ -159,35 +157,35 @@ public class GridEventStorageMessage implements 
MarshallableMessage {
     /**
      * @return the Class loader ID.
      */
-    public IgniteUuid classLoaderId() {
+    IgniteUuid classLoaderId() {
         return clsLdrId;
     }
 
     /**
      * @return Deployment mode.
      */
-    public DeploymentMode deploymentMode() {
+    DeploymentMode deploymentMode() {
         return depMode;
     }
 
     /**
      * @return Filter class name.
      */
-    public String filterClassName() {
+    String filterClassName() {
         return filterClsName;
     }
 
     /**
      * @return User version.
      */
-    public String userVersion() {
+    String userVersion() {
         return userVer;
     }
 
     /**
      * @return Node class loader participant map.
      */
-    public @Nullable Map<UUID, IgniteUuid> loaderParticipants() {
+    @Nullable Map<UUID, IgniteUuid> loaderParticipants() {
         return ldrParties != null ? Collections.unmodifiableMap(ldrParties) : 
null;
     }
 
@@ -200,9 +198,6 @@ public class GridEventStorageMessage implements 
MarshallableMessage {
 
     /** {@inheritDoc} */
     @Override public void prepareMarshal(Marshaller marsh) throws 
IgniteCheckedException {
-        if (resTopic != null)
-            resTopicBytes = U.marshal(marsh, resTopic);
-
         if (filter != null)
             filterBytes = U.marshal(marsh, filter);
 
@@ -212,12 +207,6 @@ public class GridEventStorageMessage implements 
MarshallableMessage {
 
     /** {@inheritDoc} */
     @Override public void finishUnmarshal(Marshaller marsh, ClassLoader ldr) 
throws IgniteCheckedException {
-        if (resTopicBytes != null) {
-            resTopic = U.unmarshal(marsh, resTopicBytes, ldr);
-
-            resTopicBytes = null;
-        }
-
         if (evtsBytes != null) {
             evts = U.unmarshal(marsh, evtsBytes, ldr);
 
@@ -237,7 +226,6 @@ public class GridEventStorageMessage implements 
MarshallableMessage {
         }
     }
 
-
     /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(GridEventStorageMessage.class, this);
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessor.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessor.java
index 9cdb2f424a3..cb35d78f511 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessor.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessor.java
@@ -233,16 +233,7 @@ public class DataStreamProcessor<K, V> extends 
GridProcessorAdapter {
                 }
             }
 
-            Object topic;
-
-            try {
-                topic = U.unmarshal(marsh, req.responseTopicBytes(), 
U.resolveClassLoader(null, ctx.config()));
-            }
-            catch (IgniteCheckedException e) {
-                U.error(log, "Failed to unmarshal topic from request: " + req, 
e);
-
-                return;
-            }
+            Object topic = req.responseTopic();
 
             ClassLoader clsLdr;
 
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java
index f8248e40f70..230dbbe2515 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImpl.java
@@ -205,9 +205,6 @@ public class DataStreamerImpl<K, V> implements 
IgniteDataStreamer<K, V>, Delayed
     /** Communication topic for responses. */
     private final Object topic;
 
-    /** */
-    private byte[] topicBytes;
-
     /** {@code True} if data loader has been cancelled. */
     private volatile boolean cancelled;
 
@@ -1947,9 +1944,6 @@ public class DataStreamerImpl<K, V> implements 
IgniteDataStreamer<K, V>, Delayed
 
                         updaterBytes = U.marshal(ctx, rcvr);
                     }
-
-                    if (topicBytes == null)
-                        topicBytes = U.marshal(ctx, topic);
                 }
                 catch (IgniteCheckedException e) {
                     U.error(log, "Failed to marshal.", e);
@@ -1994,7 +1988,7 @@ public class DataStreamerImpl<K, V> implements 
IgniteDataStreamer<K, V>, Delayed
 
                 DataStreamerRequest req = new DataStreamerRequest(
                     reqId,
-                    topicBytes,
+                    topic,
                     cacheName,
                     updaterBytes,
                     entries,
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerRequest.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerRequest.java
index 750c748b2ac..04af0614659 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerRequest.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerRequest.java
@@ -21,6 +21,7 @@ import java.util.Collection;
 import java.util.Map;
 import java.util.UUID;
 import org.apache.ignite.configuration.DeploymentMode;
+import org.apache.ignite.internal.GridTopicMessage;
 import org.apache.ignite.internal.Order;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.util.tostring.GridToStringInclude;
@@ -39,9 +40,8 @@ public class DataStreamerRequest implements Message {
     long reqId;
 
     /** */
-    // TODO: Refactor bytes serialization - IGNITE-27977
     @Order(1)
-    byte[] resTopicBytes;
+    GridTopicMessage resTopicMsg;
 
     /** Cache name. */
     @Order(2)
@@ -110,7 +110,7 @@ public class DataStreamerRequest implements Message {
 
     /**
      * @param reqId Request ID.
-     * @param resTopicBytes Response topic.
+     * @param resTopic Response topic.
      * @param cacheName Cache name.
      * @param updaterBytes Cache receiver.
      * @param entries Entries to put.
@@ -128,7 +128,7 @@ public class DataStreamerRequest implements Message {
      */
     public DataStreamerRequest(
         long reqId,
-        byte[] resTopicBytes,
+        Object resTopic,
         @Nullable String cacheName,
         byte[] updaterBytes,
         Collection<DataStreamerEntry> entries,
@@ -147,7 +147,7 @@ public class DataStreamerRequest implements Message {
         assert topVer != null;
 
         this.reqId = reqId;
-        this.resTopicBytes = resTopicBytes;
+        resTopicMsg = new GridTopicMessage(resTopic);
         this.cacheName = cacheName;
         this.updaterBytes = updaterBytes;
         this.entries = entries;
@@ -167,105 +167,105 @@ public class DataStreamerRequest implements Message {
     /**
      * @return Request ID.
      */
-    public long requestId() {
+    long requestId() {
         return reqId;
     }
 
     /**
      * @return Response topic.
      */
-    public byte[] responseTopicBytes() {
-        return resTopicBytes;
+    Object responseTopic() {
+        return GridTopicMessage.topic(resTopicMsg);
     }
 
     /**
      * @return Cache name.
      */
-    public String cacheName() {
+    String cacheName() {
         return cacheName;
     }
 
     /**
      * @return Updater.
      */
-    public byte[] updaterBytes() {
+    byte[] updaterBytes() {
         return updaterBytes;
     }
 
     /**
      * @return Entries to update.
      */
-    public Collection<DataStreamerEntry> entries() {
+    Collection<DataStreamerEntry> entries() {
         return entries;
     }
 
     /**
      * @return {@code True} to ignore ownership.
      */
-    public boolean ignoreDeploymentOwnership() {
+    boolean ignoreDeploymentOwnership() {
         return ignoreDepOwnership;
     }
 
     /**
      * @return Skip store flag.
      */
-    public boolean skipStore() {
+    boolean skipStore() {
         return skipStore;
     }
 
     /**
      * @return Keep binary flag.
      */
-    public boolean keepBinary() {
+    boolean keepBinary() {
         return keepBinary;
     }
 
     /**
      * @return Deployment mode.
      */
-    public DeploymentMode deploymentMode() {
+    DeploymentMode deploymentMode() {
         return depMode;
     }
 
     /**
      * @return Sample class name.
      */
-    public String sampleClassName() {
+    String sampleClassName() {
         return sampleClsName;
     }
 
     /**
      * @return User version.
      */
-    public String userVersion() {
+    String userVersion() {
         return userVer;
     }
 
     /**
      * @return Participants.
      */
-    public Map<UUID, IgniteUuid> participants() {
+    Map<UUID, IgniteUuid> participants() {
         return ldrParticipants;
     }
 
     /**
      * @return Class loader ID.
      */
-    public IgniteUuid classLoaderId() {
+    IgniteUuid classLoaderId() {
         return clsLdrId;
     }
 
     /**
      * @return {@code True} to force local deployment.
      */
-    public boolean forceLocalDeployment() {
+    boolean forceLocalDeployment() {
         return forceLocDep;
     }
 
     /**
      * @return Topology version.
      */
-    public AffinityTopologyVersion topologyVersion() {
+    AffinityTopologyVersion topologyVersion() {
         return topVer;
     }
 
@@ -280,5 +280,4 @@ public class DataStreamerRequest implements Message {
     @Override public String toString() {
         return S.toString(DataStreamerRequest.class, this);
     }
-
 }
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/running/RunningQueryManager.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/running/RunningQueryManager.java
index e35e6809c47..3bdee2d470a 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/running/RunningQueryManager.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/running/RunningQueryManager.java
@@ -712,10 +712,8 @@ public class RunningQueryManager {
                                 }
                             }, GridIoPolicy.MANAGEMENT_POOL);
                         }
-                        else {
-                            ctx.io().sendGeneric(node, GridTopic.TOPIC_QUERY, 
GridTopic.TOPIC_QUERY.ordinal(), req,
-                                GridIoPolicy.MANAGEMENT_POOL);
-                        }
+                        else
+                            ctx.io().sendGeneric(node, GridTopic.TOPIC_QUERY, 
req, GridIoPolicy.MANAGEMENT_POOL);
                     }
                     catch (IgniteCheckedException e) {
                         cancellationRuns.remove(reqId);
@@ -857,8 +855,7 @@ public class RunningQueryManager {
         }
 
         try {
-            ctx.io().sendGeneric(node, GridTopic.TOPIC_QUERY, 
GridTopic.TOPIC_QUERY.ordinal(), res,
-                GridIoPolicy.MANAGEMENT_POOL);
+            ctx.io().sendGeneric(node, GridTopic.TOPIC_QUERY, res, 
GridIoPolicy.MANAGEMENT_POOL);
         }
         catch (IgniteCheckedException e) {
             U.warn(log, "Failed to send message [node=" + node + ", msg=" + 
res +
diff --git a/modules/core/src/main/resources/META-INF/classnames.properties 
b/modules/core/src/main/resources/META-INF/classnames.properties
index b975cbde1df..e009043efb0 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -236,9 +236,7 @@ org.apache.ignite.internal.GridTopic$T1
 org.apache.ignite.internal.GridTopic$T2
 org.apache.ignite.internal.GridTopic$T3
 org.apache.ignite.internal.GridTopic$T4
-org.apache.ignite.internal.GridTopic$T5
 org.apache.ignite.internal.GridTopic$T6
-org.apache.ignite.internal.GridTopic$T7
 org.apache.ignite.internal.GridTopic$T8
 org.apache.ignite.internal.IgniteClientDisconnectedCheckedException
 org.apache.ignite.internal.IgniteComponentType
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/GridTopicExternalizableSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/GridTopicExternalizableSelfTest.java
index d34f1461c1a..6e46ee444d7 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/GridTopicExternalizableSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/GridTopicExternalizableSelfTest.java
@@ -41,9 +41,6 @@ public class GridTopicExternalizableSelfTest extends 
IgniteExternalizableAbstrac
     /** */
     private static final String A_STRING = 
"test_test_test_test_test_test_test_test_test_test_test_test_test_test";
 
-    /** */
-    private static final int AN_INT = Integer.MAX_VALUE;
-
     /**
      * @throws Exception If failed.
      */
@@ -128,23 +125,7 @@ public class GridTopicExternalizableSelfTest extends 
IgniteExternalizableAbstrac
      * @throws Exception If failed.
      */
     @Test
-    public void testSerializationTopicCreatedByStringAndIntAndLong() throws 
Exception {
-        for (Marshaller marsh : getMarshallers()) {
-            info("Test GridTopic externalization [marshaller=" + marsh + ']');
-
-            for (GridTopic topic : GridTopic.values()) {
-                Externalizable msgOut = (Externalizable)topic.topic(A_STRING, 
AN_INT, A_LONG);
-
-                assertEquals(msgOut, GridTestIoUtils.externalize(msgOut, 
marsh));
-            }
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    @Test
-    public void testSerializationTopicCreatedByStrinAndLong() throws Exception 
{
+    public void testSerializationTopicCreatedByStringAndLong() throws 
Exception {
         for (Marshaller marsh : getMarshallers()) {
             info("Test GridTopic externalization [marshaller=" + marsh + ']');
 
@@ -155,20 +136,4 @@ public class GridTopicExternalizableSelfTest extends 
IgniteExternalizableAbstrac
             }
         }
     }
-
-    /**
-     * @throws Exception If failed.
-     */
-    @Test
-    public void testSerializationTopicCreatedByStringAndUUIDAndIntAndLong() 
throws Exception {
-        for (Marshaller marsh : getMarshallers()) {
-            info("Test GridTopic externalization [marshaller=" + marsh + ']');
-
-            for (GridTopic topic : GridTopic.values()) {
-                Externalizable msgOut = (Externalizable)topic.topic(A_STRING, 
AN_UUID, AN_INT, A_LONG);
-
-                assertEquals(msgOut, GridTestIoUtils.externalize(msgOut, 
marsh));
-            }
-        }
-    }
 }
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/managers/deployment/DeploymentRequestOfUnknownClassProcessingTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/managers/deployment/DeploymentRequestOfUnknownClassProcessingTest.java
index 6abf93cd8fc..5ab4b6b4b22 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/managers/deployment/DeploymentRequestOfUnknownClassProcessingTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/managers/deployment/DeploymentRequestOfUnknownClassProcessingTest.java
@@ -21,7 +21,6 @@ import java.net.URL;
 import java.util.UUID;
 import java.util.concurrent.TimeUnit;
 import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.GridTopic;
 import org.apache.ignite.internal.IgniteEx;
 import org.apache.ignite.internal.managers.communication.GridIoPolicy;
 import org.apache.ignite.internal.managers.communication.GridMessageListener;
@@ -99,7 +98,7 @@ public class DeploymentRequestOfUnknownClassProcessingTest 
extends GridCommonAbs
 
         remNodeLog.registerListener(remNodeLogLsnr);
 
-        GridTopic.T1 topic = 
TOPIC_CLASSLOAD.topic(IgniteUuid.fromUuid(locNode.localNode().id()));
+        Object topic = 
TOPIC_CLASSLOAD.topic(IgniteUuid.fromUuid(locNode.localNode().id()));
 
         locNode.context().io().addMessageListener(topic, new 
GridMessageListener() {
             @Override public void onMessage(UUID nodeId, Object msg, byte plc) 
{
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImplSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImplSelfTest.java
index b970bf0d0cf..625f290d1c6 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImplSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImplSelfTest.java
@@ -39,6 +39,7 @@ import org.apache.ignite.cache.CacheServerNotFoundException;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.GridTopicMessage;
 import org.apache.ignite.internal.IgniteEx;
 import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.managers.communication.GridIoMessage;
@@ -687,7 +688,7 @@ public class DataStreamerImplSelfTest extends 
GridCommonAbstractTest {
 
                         appMsg = new DataStreamerRequest(
                             req.requestId(),
-                            req.responseTopicBytes(),
+                            req.responseTopic(),
                             req.cacheName(),
                             req.updaterBytes(),
                             req.entries(),
@@ -705,8 +706,7 @@ public class DataStreamerImplSelfTest extends 
GridCommonAbstractTest {
 
                         msg = new GridIoMessage(
                             GridTestUtils.<Byte>getFieldValue(ioMsg, "plc"),
-                            GridTestUtils.getFieldValue(ioMsg, "topic"),
-                            GridTestUtils.<Integer>getFieldValue(ioMsg, 
"topicOrd"),
+                            
GridTopicMessage.topic(GridTestUtils.getFieldValue(ioMsg, "topicMsg")),
                             appMsg,
                             GridTestUtils.<Boolean>getFieldValue(ioMsg, 
"ordered"),
                             ioMsg.timeout(),
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/security/IgniteSecurityProcessorTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/security/IgniteSecurityProcessorTest.java
index 6d29dc89a44..32da11cbc7d 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/security/IgniteSecurityProcessorTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/security/IgniteSecurityProcessorTest.java
@@ -80,7 +80,6 @@ public class IgniteSecurityProcessorTest extends 
AbstractSecurityTest {
             UUID.randomUUID(),
             PUBLIC_POOL,
             TOPIC_CACHE,
-            TOPIC_CACHE.ordinal(),
             new IgniteDiagnosticRequest(),
             false,
             0,
diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
index 9e84486f16b..17179e069c4 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
@@ -1687,7 +1687,6 @@ public class IgniteH2Indexing implements 
GridQueryIndexing {
 
     /**
      * @param topic Topic.
-     * @param topicOrd Topic ordinal for {@link GridTopic}.
      * @param nodes Nodes.
      * @param msg Message.
      * @param specialize Optional closure to specialize message for each node.
@@ -1698,7 +1697,6 @@ public class IgniteH2Indexing implements 
GridQueryIndexing {
      */
     public boolean send(
         Object topic,
-        int topicOrd,
         Collection<ClusterNode> nodes,
         Message msg,
         @Nullable IgniteBiClosure<ClusterNode, Message, Message> specialize,
@@ -1731,7 +1729,7 @@ public class IgniteH2Indexing implements 
GridQueryIndexing {
                         ((GridCacheQueryMarshallable)msg).marshall(marshaller);
                 }
 
-                ctx.io().sendGeneric(node, topic, topicOrd, msg, plc);
+                ctx.io().sendGeneric(node, topic, msg, plc);
             }
             catch (IgniteCheckedException e) {
                 ok = false;
diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java
index 9741e864f1a..fea5f1541c0 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java
@@ -425,7 +425,6 @@ public class H2TreeIndex extends H2TreeIndexBase {
      */
     public void send(Collection<ClusterNode> nodes, Message msg) {
         boolean res = getTable().tableDescriptor().indexing().send(msgTopic,
-            -1,
             nodes,
             msg,
             null,
diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
index 977f44bda68..f2d943d3334 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
@@ -1218,7 +1218,6 @@ public class GridReduceQueryExecutor {
             log.debug("Sending: [msg=" + msg + ", nodes=" + nodes + ", 
specialize=" + specialize + "]");
 
         return h2.send(GridTopic.TOPIC_QUERY,
-            GridTopic.TOPIC_QUERY.ordinal(),
             nodes,
             msg,
             specialize,

Reply via email to