use of javax.jms.JMSProducer in project wildfly by wildfly.
the class JMSSender method sendMessage.
@TransactionAttribute(NOT_SUPPORTED)
public void sendMessage(String payload) {
try (JMSContext context = connectionFactory.createContext()) {
JMSProducer producer = context.createProducer();
producer.send(queue, payload);
}
}
use of javax.jms.JMSProducer in project wildfly by wildfly.
the class AppScopedBean method sendMessage.
public void sendMessage() {
JMSProducer producer = context.createProducer();
producer.send(queue, "a message");
}
use of javax.jms.JMSProducer in project ART-TIME by Artezio.
the class MailingEngine method sendOverJms.
private void sendOverJms(Mail mail) {
ObjectMessage objectMessage = jmsContext.createObjectMessage(mail);
JMSProducer jmsProducer = jmsContext.createProducer();
jmsProducer.send(jmsQueue, objectMessage);
}
use of javax.jms.JMSProducer in project qpid-broker-j by apache.
the class DeliveryDelayTest method testDeliveryDelay.
@Test
public void testDeliveryDelay() throws Exception {
try (JMSContext context = getConnectionBuilder().buildConnectionFactory().createContext()) {
Destination queue = createQueue(context, BrokerAdmin.TEST_QUEUE_NAME, true);
final AtomicLong messageReceiptTime = new AtomicLong();
final CountDownLatch receivedLatch = new CountDownLatch(1);
context.createConsumer(queue).setMessageListener(message -> {
messageReceiptTime.set(System.currentTimeMillis());
receivedLatch.countDown();
});
JMSProducer producer = context.createProducer().setDeliveryDelay(DELIVERY_DELAY);
final long messageSentTime = System.currentTimeMillis();
producer.send(queue, "delayed message");
final boolean messageArrived = receivedLatch.await(DELIVERY_DELAY * 3, TimeUnit.MILLISECONDS);
assertTrue("Delayed message did not arrive within expected period", messageArrived);
final long actualDelay = messageReceiptTime.get() - messageSentTime;
assertTrue(String.format("Message was not delayed by sufficient time (%d). Actual delay (%d)", DELIVERY_DELAY, actualDelay), actualDelay >= DELIVERY_DELAY);
}
}
use of javax.jms.JMSProducer in project eap-additional-testsuite by jboss-set.
the class AppScopedBean method sendMessage.
public void sendMessage() {
JMSProducer producer = context.createProducer();
producer.send(queue, "a message");
}
Aggregations