use of org.apache.activemq.command.ActiveMQTempQueue in project activemq-artemis by apache.
the class RequestReplyNoAdvisoryNetworkTest method doTestNonAdvisoryNetworkRequestReply.
public void doTestNonAdvisoryNetworkRequestReply() throws Exception {
waitForBridgeFormation(a, 1, 0);
waitForBridgeFormation(b, 1, 0);
ActiveMQConnectionFactory sendFactory = createConnectionFactory(a);
ActiveMQConnection sendConnection = createConnection(sendFactory);
ActiveMQSession sendSession = (ActiveMQSession) sendConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageProducer producer = sendSession.createProducer(sendQ);
ActiveMQTempQueue realReplyQ = (ActiveMQTempQueue) sendSession.createTemporaryQueue();
TextMessage message = sendSession.createTextMessage("1");
message.setJMSReplyTo(realReplyQ);
producer.send(message);
LOG.info("request sent");
// responder
ActiveMQConnectionFactory consumerFactory = createConnectionFactory(b);
ActiveMQConnection consumerConnection = createConnection(consumerFactory);
ActiveMQSession consumerSession = (ActiveMQSession) consumerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageConsumer consumer = consumerSession.createConsumer(sendQ);
TextMessage received = (TextMessage) consumer.receive(receiveTimeout);
assertNotNull("got request from sender ok", received);
LOG.info("got request, sending reply");
MessageProducer consumerProducer = consumerSession.createProducer(received.getJMSReplyTo());
consumerProducer.send(consumerSession.createTextMessage("got " + received.getText()));
// temp dest on reply broker tied to this connection, setOptimizedDispatch=true ensures
// message gets delivered before destination is removed
consumerConnection.close();
// reply consumer
MessageConsumer replyConsumer = sendSession.createConsumer(realReplyQ);
TextMessage reply = (TextMessage) replyConsumer.receive(receiveTimeout);
assertNotNull("expected reply message", reply);
assertEquals("text is as expected", "got 1", reply.getText());
sendConnection.close();
LOG.info("checking for dangling temp destinations");
// ensure all temp dests get cleaned up on all brokers
for (BrokerService brokerService : brokers) {
final RegionBroker regionBroker = (RegionBroker) brokerService.getRegionBroker();
assertTrue("all temps are gone on " + regionBroker.getBrokerName(), Wait.waitFor(new Wait.Condition() {
@Override
public boolean isSatisified() throws Exception {
Map<?, ?> tempTopics = regionBroker.getTempTopicRegion().getDestinationMap();
LOG.info("temp topics on " + regionBroker.getBrokerName() + ", " + tempTopics);
Map<?, ?> tempQ = regionBroker.getTempQueueRegion().getDestinationMap();
LOG.info("temp queues on " + regionBroker.getBrokerName() + ", " + tempQ);
return tempQ.isEmpty() && tempTopics.isEmpty();
}
}));
}
}
use of org.apache.activemq.command.ActiveMQTempQueue in project activemq-artemis by apache.
the class NetworkDestinationFilterTest method testFilter.
public void testFilter() throws Exception {
NetworkBridgeConfiguration config = new NetworkBridgeConfiguration();
assertEquals(AdvisorySupport.CONSUMER_ADVISORY_TOPIC_PREFIX + ">", config.getDestinationFilter());
List<ActiveMQDestination> dests = new ArrayList<>();
config.setDynamicallyIncludedDestinations(dests);
assertEquals(AdvisorySupport.CONSUMER_ADVISORY_TOPIC_PREFIX + ">", config.getDestinationFilter());
dests.add(new ActiveMQQueue("TEST.>"));
dests.add(new ActiveMQTopic("TEST.>"));
dests.add(new ActiveMQTempQueue("TEST.>"));
String prefix = AdvisorySupport.CONSUMER_ADVISORY_TOPIC_PREFIX;
assertEquals(prefix + "Queue.TEST.>," + prefix + "Topic.TEST.>", config.getDestinationFilter());
}
use of org.apache.activemq.command.ActiveMQTempQueue in project activemq-artemis by apache.
the class ActiveMQTempQueueTest method createObject.
@Override
public Object createObject() throws Exception {
ActiveMQTempQueue info = new ActiveMQTempQueue();
populateObject(info);
return info;
}
use of org.apache.activemq.command.ActiveMQTempQueue in project activemq-artemis by apache.
the class ActiveMQTempQueueTest method populateObject.
@Override
protected void populateObject(Object object) throws Exception {
super.populateObject(object);
ActiveMQTempQueue info = (ActiveMQTempQueue) object;
}
use of org.apache.activemq.command.ActiveMQTempQueue in project activemq-artemis by apache.
the class ActiveMQTempQueueTest method createObject.
@Override
public Object createObject() throws Exception {
ActiveMQTempQueue info = new ActiveMQTempQueue();
populateObject(info);
return info;
}
Aggregations