ARTEMIS-1793 fix 'destination-type' STOMP header (fix)

This commit is contained in:
Justin Bertram 2018-04-18 11:52:22 -04:00 committed by Clebert Suconic
parent 37bc26e574
commit a72046a0e3
2 changed files with 11 additions and 0 deletions

View File

@ -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<SimpleString> 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)) {

View File

@ -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