use of org.apache.activemq.command.ActiveMQDestination in project camel by apache.
the class ActiveMQOriginalDestinationTest method testActiveMQOriginalDestination.
@Test
public void testActiveMQOriginalDestination() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMessageCount(1);
template.sendBody("activemq:queue:foo", "Hello World");
assertMockEndpointsSatisfied();
// consume from bar
Exchange out = consumer.receive("activemq:queue:bar", 5000);
assertNotNull(out);
// and we should have foo as the original destination
JmsMessage msg = out.getIn(JmsMessage.class);
Message jms = msg.getJmsMessage();
ActiveMQMessage amq = assertIsInstanceOf(ActiveMQMessage.class, jms);
ActiveMQDestination original = amq.getOriginalDestination();
assertNotNull(original);
assertEquals("foo", original.getPhysicalName());
assertEquals("Queue", original.getDestinationTypeAsString());
}
use of org.apache.activemq.command.ActiveMQDestination in project activemq-artemis by apache.
the class JmsQueueWildcardSendReceiveTest method testReceiveWildcardQueueMidAsterisk.
public void testReceiveWildcardQueueMidAsterisk() throws Exception {
connection.start();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
ActiveMQDestination destination1 = (ActiveMQDestination) session.createQueue(destination1String);
ActiveMQDestination destination4 = (ActiveMQDestination) session.createQueue(destination4String);
Message m = null;
MessageConsumer consumer = null;
String text = null;
sendMessage(session, destination1, destination1String);
sendMessage(session, destination4, destination4String);
ActiveMQDestination destination8 = (ActiveMQDestination) session.createQueue("TEST.*.ONE");
consumer = session.createConsumer(destination8);
m = consumer.receive(1000);
assertNotNull(m);
text = ((TextMessage) m).getText();
if (!(text.equals(destination1String) || text.equals(destination4String))) {
fail("unexpected message:" + text);
}
m = consumer.receive(1000);
assertNotNull(m);
text = ((TextMessage) m).getText();
if (!(text.equals(destination1String) || text.equals(destination4String))) {
fail("unexpected message:" + text);
}
assertNull(consumer.receiveNoWait());
}
use of org.apache.activemq.command.ActiveMQDestination in project activemq-artemis by apache.
the class JmsMultipleBrokersTestSupport method createDestination.
protected ActiveMQDestination createDestination(String name, boolean topic) throws JMSException {
Destination dest;
if (topic) {
dest = new ActiveMQTopic(name);
destinations.put(name, dest);
return (ActiveMQDestination) dest;
} else {
dest = new ActiveMQQueue(name);
destinations.put(name, dest);
return (ActiveMQDestination) dest;
}
}
use of org.apache.activemq.command.ActiveMQDestination in project activemq-artemis by apache.
the class JmsTopicWildcardSendReceiveTest method testReceiveWildcardTopicMatchSinglePastTheEndWildcard.
public void testReceiveWildcardTopicMatchSinglePastTheEndWildcard() throws Exception {
connection.start();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
ActiveMQDestination destination1 = (ActiveMQDestination) session.createTopic("a.>");
ActiveMQDestination destination2 = (ActiveMQDestination) session.createTopic("a");
Message m = null;
MessageConsumer consumer = null;
String text = null;
consumer = session.createConsumer(destination1);
sendMessage(session, destination2, destination3String);
m = consumer.receive(1000);
assertNotNull(m);
text = ((TextMessage) m).getText();
if (!(text.equals(destination1String) || text.equals(destination3String))) {
fail("unexpected message:" + text);
}
assertNull(consumer.receiveNoWait());
}
use of org.apache.activemq.command.ActiveMQDestination in project activemq-artemis by apache.
the class JmsTopicWildcardSendReceiveTest method testReceiveWildcardTopicEndGreaterThan.
public void testReceiveWildcardTopicEndGreaterThan() throws Exception {
connection.start();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
ActiveMQDestination destination1 = (ActiveMQDestination) session.createTopic(destination1String);
ActiveMQDestination destination2 = (ActiveMQDestination) session.createTopic(destination2String);
ActiveMQDestination destination3 = (ActiveMQDestination) session.createTopic(destination3String);
Message m = null;
MessageConsumer consumer = null;
String text = null;
ActiveMQDestination destination7 = (ActiveMQDestination) session.createTopic("TEST.ONE.>");
consumer = session.createConsumer(destination7);
sendMessage(session, destination1, destination1String);
sendMessage(session, destination2, destination2String);
sendMessage(session, destination3, destination3String);
m = consumer.receive(1000);
assertNotNull(m);
text = ((TextMessage) m).getText();
if (!(text.equals(destination1String) || text.equals(destination2String) || text.equals(destination3String))) {
fail("unexpected message:" + text);
}
m = consumer.receive(1000);
assertNotNull(m);
if (!(text.equals(destination1String) || text.equals(destination2String) || text.equals(destination3String))) {
fail("unexpected message:" + text);
}
m = consumer.receive(1000);
assertNotNull(m);
if (!(text.equals(destination1String) || text.equals(destination2String) || text.equals(destination3String))) {
fail("unexpected message:" + text);
}
assertNull(consumer.receiveNoWait());
}
Aggregations