Search in sources :

Example 46 with QueueReceiver

use of javax.jms.QueueReceiver in project zipkin by openzipkin.

the class ActiveMQSpanConsumer method registerInNewSession.

/**
 * JMS contract is one session per thread: we need a new session up to our concurrency level.
 */
void registerInNewSession(ActiveMQConnection connection, String queue) throws JMSException {
    // Pass redundant info as we can't use default method in activeMQ
    QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
    // No need to do anything on ActiveMQ side as physical queues are created on demand
    Queue destination = session.createQueue(queue);
    QueueReceiver receiver = session.createReceiver(destination);
    receiver.setMessageListener(this);
    sessionToReceiver.put(session, receiver);
}
Also used : QueueReceiver(javax.jms.QueueReceiver) Queue(javax.jms.Queue) QueueSession(javax.jms.QueueSession)

Aggregations

QueueReceiver (javax.jms.QueueReceiver)46 QueueSession (javax.jms.QueueSession)40 Queue (javax.jms.Queue)34 QueueSender (javax.jms.QueueSender)22 TextMessage (javax.jms.TextMessage)21 Message (javax.jms.Message)19 Test (org.junit.jupiter.api.Test)13 Serializable (java.io.Serializable)10 Test (org.junit.Test)10 QueueConnection (javax.jms.QueueConnection)9 JMSException (javax.jms.JMSException)7 QueueConnectionFactory (javax.jms.QueueConnectionFactory)6 InitialContext (javax.naming.InitialContext)5 Destination (javax.jms.Destination)4 MessageProducer (javax.jms.MessageProducer)4 IfsaException (nl.nn.adapterframework.extensions.ifsa.IfsaException)4 Enumeration (java.util.Enumeration)3 HashMap (java.util.HashMap)3 BytesMessage (javax.jms.BytesMessage)3 QueueBrowser (javax.jms.QueueBrowser)3