use of org.apache.activemq.command.ActiveMQQueue in project gocd by gocd.
the class ActiveMqMessagingService method removeQueue.
public void removeQueue(String queueName) {
try {
ActiveMQQueue destination = new ActiveMQQueue(queueName);
ConnectionContext connectionContext = BrokerSupport.getConnectionContext(broker.getBroker());
Destination brokerDestination = broker.getDestination(destination);
List<Subscription> consumers = brokerDestination.getConsumers();
for (Subscription consumer : consumers) {
consumer.remove(connectionContext, brokerDestination);
brokerDestination.removeSubscription(connectionContext, consumer, 0);
}
broker.getBroker().removeDestination(connectionContext, destination, 1000);
broker.removeDestination(destination);
} catch (Exception e) {
throw bomb(e);
}
}
use of org.apache.activemq.command.ActiveMQQueue in project ignite by apache.
the class IgniteJmsStreamerTest method testQueueFromName.
/**
* @throws Exception If failed.
*/
public void testQueueFromName() throws Exception {
Destination dest = new ActiveMQQueue(QUEUE_NAME);
// produce messages into the queue
produceObjectMessages(dest, false);
try (IgniteDataStreamer<String, String> dataStreamer = grid().dataStreamer(DEFAULT_CACHE_NAME)) {
JmsStreamer<ObjectMessage, String, String> jmsStreamer = newJmsStreamer(ObjectMessage.class, dataStreamer);
jmsStreamer.setDestinationType(Queue.class);
jmsStreamer.setDestinationName(QUEUE_NAME);
// subscribe to cache PUT events and return a countdown latch starting at CACHE_ENTRY_COUNT
CountDownLatch latch = subscribeToPutEvents(CACHE_ENTRY_COUNT);
jmsStreamer.start();
// all cache PUT events received in 10 seconds
latch.await(10, TimeUnit.SECONDS);
assertAllCacheEntriesLoaded();
jmsStreamer.stop();
}
}
use of org.apache.activemq.command.ActiveMQQueue in project camel by apache.
the class JmsEndpointWithCustomDestinationTest method testMessageSentToCustomEndpoint.
@Test
public void testMessageSentToCustomEndpoint() throws Exception {
ActiveMQQueue jmsQueue = context.getRegistry().lookupByNameAndType("jmsQueue", ActiveMQQueue.class);
assertNotNull("jmsQueue", jmsQueue);
assertEquals("jmsqueue.getPhysicalName()", "Test.Camel.CustomEndpoint", jmsQueue.getPhysicalName());
getMockEndpoint("mock:result").expectedBodiesReceived(expectedBody);
template.sendBody("direct:start", expectedBody);
assertMockEndpointsSatisfied();
}
use of org.apache.activemq.command.ActiveMQQueue in project camel by apache.
the class JmsRequestReplyManualReplyTest method testManualRequestReply.
@Test
public void testManualRequestReply() throws Exception {
context.start();
// send using pure JMS API to set a custom JMSReplyTo
jms.send(new ActiveMQQueue("foo"), new MessageCreator() {
public Message createMessage(Session session) throws JMSException {
TextMessage msg = session.createTextMessage("Hello World");
msg.setJMSReplyTo(new ActiveMQQueue("bar"));
return msg;
}
});
assertTrue(latch.await(5, TimeUnit.SECONDS));
String reply = consumer.receiveBody(tempName, 5000, String.class);
assertEquals("Bye World", reply);
}
use of org.apache.activemq.command.ActiveMQQueue in project ignite by apache.
the class IgniteJmsStreamerTest method testInsertMultipleCacheEntriesFromOneMessage.
/**
* @throws Exception If failed.
*/
public void testInsertMultipleCacheEntriesFromOneMessage() throws Exception {
Destination dest = new ActiveMQQueue(QUEUE_NAME);
// produce A SINGLE MESSAGE, containing all data, into the queue
produceStringMessages(dest, true);
try (IgniteDataStreamer<String, String> dataStreamer = grid().dataStreamer(DEFAULT_CACHE_NAME)) {
JmsStreamer<TextMessage, String, String> jmsStreamer = newJmsStreamer(TextMessage.class, dataStreamer);
jmsStreamer.setDestination(dest);
// subscribe to cache PUT events and return a countdown latch starting at CACHE_ENTRY_COUNT
CountDownLatch latch = subscribeToPutEvents(CACHE_ENTRY_COUNT);
jmsStreamer.start();
// all cache PUT events received in 10 seconds
latch.await(10, TimeUnit.SECONDS);
assertAllCacheEntriesLoaded();
jmsStreamer.stop();
}
}
Aggregations