use of javax.jms.MessageProducer in project tomee by apache.
the class LocalClientTest method testJmsConnection.
private void testJmsConnection(final javax.jms.Connection connection) throws JMSException {
final Session session = connection.createSession(false, Session.DUPS_OK_ACKNOWLEDGE);
final Topic topic = session.createTopic("test");
final MessageProducer producer = session.createProducer(topic);
producer.send(session.createMessage());
producer.close();
session.close();
connection.close();
}
use of javax.jms.MessageProducer in project tomee by apache.
the class AMQXASupportTest method testConnection.
private void testConnection(final Connection connection) throws JMSException, InterruptedException {
try {
final Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
final MessageProducer producer = session.createProducer(destination);
producer.send(session.createTextMessage(TEXT));
assertTrue(Listener.sync());
} finally {
try {
connection.close();
} catch (final JMSException e) {
// no-op
}
}
}
use of javax.jms.MessageProducer in project tomee by apache.
the class ActivationContainerOverwriteReadTheContainerConfigurationTest method testConnection.
private void testConnection(final Connection connection) throws JMSException, InterruptedException {
try {
final Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
final MessageProducer producer = session.createProducer(destination);
producer.send(session.createTextMessage(TEXT));
assertTrue(Listener.sync());
} finally {
try {
connection.close();
} catch (final JMSException e) {
// no-op
}
}
}
use of javax.jms.MessageProducer in project tomee by apache.
the class JmsMdbContainerTest method sendMessage.
private void sendMessage(final ConnectionFactory connectionFactory, final String bean, final String text) throws JMSException, InterruptedException {
WidgetBean.lock.lock();
try {
final Connection connection = connectionFactory.createConnection();
connection.start();
// Create a Session
final Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
final Queue queue = session.createQueue(bean);
// Create a MessageProducer from the Session to the Topic or Queue
final MessageProducer producer = session.createProducer(queue);
producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
// Create a message
final TextMessage message = session.createTextMessage(text);
// Tell the producer to send the message
producer.send(message);
WidgetBean.messageRecieved.await();
} finally {
WidgetBean.lock.unlock();
}
}
use of javax.jms.MessageProducer in project tomee by apache.
the class ActivationContainerOverwriteSystemContainerIdTest method testConnection.
private void testConnection(final Connection connection) throws JMSException, InterruptedException {
try {
final Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
final MessageProducer producer = session.createProducer(destination);
producer.send(session.createTextMessage(TEXT));
assertTrue(Listener.sync());
} finally {
try {
connection.close();
} catch (final JMSException e) {
// no-op
}
}
}
Aggregations