mirror of https://github.com/apache/activemq.git
https://issues.apache.org/jira/browse/AMQ-3496 - make use of the org.apache.activemq.command.UnresolvedDestinationTransformer to provide a default value for an unqualified destinations string for a stomp replyTo header
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1170474 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ede4964539
commit
68a8b6d62a
|
@ -48,4 +48,9 @@ public class DefaultUnresolvedDestinationTransformer implements UnresolvedDestin
|
|||
throw new JMSException("Unresolvable destination: " + e.getMessage() + ": " + dest);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActiveMQDestination transform(String dest) throws JMSException {
|
||||
return new ActiveMQQueue(dest);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,5 +22,5 @@ import javax.jms.JMSException;
|
|||
public interface UnresolvedDestinationTransformer {
|
||||
|
||||
public ActiveMQDestination transform(Destination dest) throws JMSException;
|
||||
|
||||
public ActiveMQDestination transform(String dest) throws JMSException;
|
||||
}
|
||||
|
|
|
@ -187,6 +187,15 @@ public class LegacyFrameTranslator implements FrameTranslator {
|
|||
} else if (name.startsWith("/temp-topic/")) {
|
||||
return converter.createTempTopic(name);
|
||||
} else {
|
||||
try {
|
||||
ActiveMQDestination fallback = ActiveMQDestination.getUnresolvableDestinationTransformer().transform(name);
|
||||
if (fallback != null) {
|
||||
return fallback;
|
||||
}
|
||||
} catch (JMSException e) {
|
||||
throw new ProtocolException("Illegal destination name: [" + name + "] -- ActiveMQ STOMP destinations "
|
||||
+ "must begin with one of: /queue/ /topic/ /temp-queue/ /temp-topic/", false, e);
|
||||
}
|
||||
throw new ProtocolException("Illegal destination name: [" + name + "] -- ActiveMQ STOMP destinations "
|
||||
+ "must begin with one of: /queue/ /topic/ /temp-queue/ /temp-topic/");
|
||||
}
|
||||
|
|
|
@ -1529,6 +1529,22 @@ public class StompTest extends CombinationTestSupport {
|
|||
assertEquals(stompMessage.getHeaders().get(Stomp.Headers.Message.ORIGINAL_DESTINATION), "/queue/" + getQueueName());
|
||||
}
|
||||
|
||||
public void testDefaultJMSReplyToDest() throws Exception {
|
||||
stompConnection.connect("system", "manager");
|
||||
|
||||
HashMap<String, String> headers = new HashMap<String, String>();
|
||||
long timestamp = System.currentTimeMillis();
|
||||
headers.put(Stomp.Headers.Send.REPLY_TO, "JustAString");
|
||||
headers.put(Stomp.Headers.Send.PERSISTENT, "true");
|
||||
|
||||
stompConnection.send("/queue/" + getQueueName(), "msg-with-reply-to", null, headers);
|
||||
|
||||
stompConnection.subscribe("/queue/" + getQueueName());
|
||||
StompFrame stompMessage = stompConnection.receive(1000);
|
||||
assertNotNull(stompMessage);
|
||||
assertEquals("" + stompMessage, stompMessage.getHeaders().get(Stomp.Headers.Send.REPLY_TO), "/queue/" + "JustAString");
|
||||
}
|
||||
|
||||
public void testPersistent() throws Exception {
|
||||
stompConnection.connect("system", "manager");
|
||||
|
||||
|
|
Loading…
Reference in New Issue