use of javax.jms.JMSConsumer in project wildfly by wildfly.
the class AbstractMessagingHATestCase method receiveMessage.
protected static void receiveMessage(Context ctx, String destinationLookup, String expectedText) throws NamingException {
ConnectionFactory cf = (ConnectionFactory) ctx.lookup("jms/RemoteConnectionFactory");
assertNotNull(cf);
Destination destination = (Destination) ctx.lookup(destinationLookup);
assertNotNull(destination);
try (JMSContext context = cf.createContext("guest", "guest")) {
JMSConsumer consumer = context.createConsumer(destination);
String text = consumer.receiveBody(String.class, 5000);
assertNotNull(text);
assertEquals(expectedText, text);
}
}
use of javax.jms.JMSConsumer in project wildfly by wildfly.
the class ClusteredMessagingTestCase method receiveMessage.
protected static void receiveMessage(Context ctx, String destinationLookup, String expectedText) throws NamingException {
ConnectionFactory cf = (ConnectionFactory) ctx.lookup("jms/RemoteConnectionFactory");
assertNotNull(cf);
Destination destination = (Destination) ctx.lookup(destinationLookup);
assertNotNull(destination);
try (JMSContext context = cf.createContext("guest", "guest")) {
JMSConsumer consumer = context.createConsumer(destination);
receiveMessage(consumer, expectedText);
}
}
use of javax.jms.JMSConsumer in project wildfly by wildfly.
the class MDBWithVaultedPropertiesTestCase method sendAndReceiveMessage.
@Test
public void sendAndReceiveMessage() {
try (JMSContext context = factory.createContext()) {
TemporaryQueue replyTo = context.createTemporaryQueue();
String text = UUID.randomUUID().toString();
context.createProducer().setJMSReplyTo(replyTo).send(queue, text);
JMSConsumer consumer = context.createConsumer(replyTo);
String reply = consumer.receiveBody(String.class, 5000);
assertEquals(text, reply);
}
}
use of javax.jms.JMSConsumer in project wildfly by wildfly.
the class VaultedInjectedJMSContextTestCase method sendMessage.
@Test
public void sendMessage() throws JMSException {
String text = UUID.randomUUID().toString();
try (JMSContext context = factory.createContext()) {
TemporaryQueue tempQueue = context.createTemporaryQueue();
producerBean.sendToDestination(tempQueue, text);
JMSConsumer consumer = context.createConsumer(tempQueue);
String reply = consumer.receiveBody(String.class, adjust(2000));
assertEquals(text, reply);
}
}
use of javax.jms.JMSConsumer in project wildfly by wildfly.
the class MessagingBean method checkInjectedResources.
public void checkInjectedResources() {
assertNotNull(queue1);
assertNotNull(queue2);
assertNotNull(queue3);
assertNotNull(queue4);
assertNotNull(topic1);
assertNotNull(topic2);
assertNotNull(factory1);
assertNotNull(factory2);
assertNotNull(factory3);
assertNotNull(factory4);
assertNotNull(factory5);
assertNotNull(factory6);
JMSContext context = factory3.createContext("guest", "guest", AUTO_ACKNOWLEDGE);
JMSConsumer consumer = context.createConsumer(queue4);
assertNotNull(consumer);
consumer.close();
}
Aggregations