diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompUtils.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompUtils.java index ae6bcb9318..29e4217ae9 100644 --- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompUtils.java +++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompUtils.java @@ -24,6 +24,7 @@ import java.util.Map.Entry; import java.util.Set; import org.apache.activemq.artemis.api.core.Message; +import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.core.client.impl.ClientMessageImpl; import org.apache.activemq.artemis.reader.MessageUtil; @@ -123,6 +124,9 @@ public class StompUtils { if (message.getValidatedUserID() != null) { command.addHeader(Stomp.Headers.Message.VALIDATED_USER, message.getValidatedUserID()); } + if (message.getByteProperty(Message.HDR_ROUTING_TYPE.toString()) != null) { + command.addHeader(Stomp.Headers.Send.DESTINATION_TYPE, RoutingType.getType(message.getByteProperty(Message.HDR_ROUTING_TYPE.toString())).toString()); + } // now let's add all the rest of the message headers Set names = message.getPropertyNames(); @@ -130,6 +134,7 @@ public class StompUtils { if (name.equals(ClientMessageImpl.REPLYTO_HEADER_NAME) || name.equals(Message.HDR_CONTENT_TYPE) || name.equals(Message.HDR_VALIDATED_USER) || + name.equals(Message.HDR_ROUTING_TYPE) || name.equals(MessageUtil.TYPE_HEADER_NAME) || name.equals(MessageUtil.CORRELATIONID_HEADER_NAME) || name.toString().equals(Stomp.Headers.Message.DESTINATION)) { diff --git a/docs/user-manual/en/protocols-interoperability.md b/docs/user-manual/en/protocols-interoperability.md index 7904e45e23..3a6a26aeb1 100644 --- a/docs/user-manual/en/protocols-interoperability.md +++ b/docs/user-manual/en/protocols-interoperability.md @@ -400,6 +400,12 @@ If no indication of routing type is supplied then anycast semantics are used. The `destination` header maps to an address of the same name. If the `destination` header used a prefix then the prefix is stripped. +#### Receiving + +When a client receives a message from the broker the message will have the `destination-type` +header set to either `MULTICAST` or `ANYCAST` as determined when the message was originally +sent/routed. + #### Subscribing When a Stomp client subscribes to a destination (using a `SUBSCRIBE` frame), the protocol