Search in sources :

Example 66 with QueueConnection

use of javax.jms.QueueConnection in project brave by openzipkin.

the class TracingConnection method createQueueSession.

// QueueConnection
@Override
public QueueSession createQueueSession(boolean transacted, int acknowledgeMode) throws JMSException {
    checkQueueConnection();
    QueueSession qs = ((QueueConnection) delegate).createQueueSession(transacted, acknowledgeMode);
    return TracingSession.create(qs, jmsTracing);
}
Also used : XAQueueConnection(javax.jms.XAQueueConnection) QueueConnection(javax.jms.QueueConnection) QueueSession(javax.jms.QueueSession)

Example 67 with QueueConnection

use of javax.jms.QueueConnection in project qpid-broker-j by apache.

the class QueueSessionTest method testQueueSessionCannotCreateDurableSubscriber.

@Test
public void testQueueSessionCannotCreateDurableSubscriber() throws Exception {
    Topic topic = createTopic(getTestName());
    QueueConnection queueConnection = getQueueConnection();
    try {
        QueueSession queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
        try {
            queueSession.createDurableSubscriber(topic, "abc");
            fail("expected exception did not occur");
        } catch (javax.jms.IllegalStateException s) {
        // PASS
        }
    } finally {
        queueConnection.close();
    }
}
Also used : QueueConnection(javax.jms.QueueConnection) Topic(javax.jms.Topic) QueueSession(javax.jms.QueueSession) Test(org.junit.Test)

Example 68 with QueueConnection

use of javax.jms.QueueConnection in project qpid-broker-j by apache.

the class QueueSessionTest method testQueueSessionCannotCreateTopics.

@Test
public void testQueueSessionCannotCreateTopics() throws Exception {
    QueueConnection queueConnection = getQueueConnection();
    try {
        QueueSession queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
        try {
            queueSession.createTopic("abc");
            fail("expected exception did not occur");
        } catch (javax.jms.IllegalStateException s) {
        // PASS
        }
    } finally {
        queueConnection.close();
    }
}
Also used : QueueConnection(javax.jms.QueueConnection) QueueSession(javax.jms.QueueSession) Test(org.junit.Test)

Example 69 with QueueConnection

use of javax.jms.QueueConnection in project qpid-broker-j by apache.

the class QueueSenderTest method sendToUnknownQueue.

@Test
public void sendToUnknownQueue() throws Exception {
    QueueConnection connection = ((QueueConnection) getConnectionBuilder().build());
    try {
        QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
        Queue invalidDestination = session.createQueue("unknown");
        try {
            QueueSender sender = session.createSender(invalidDestination);
            sender.send(session.createMessage());
            fail("Exception not thrown");
        } catch (InvalidDestinationException e) {
        // PASS
        }
    } finally {
        connection.close();
    }
}
Also used : QueueConnection(javax.jms.QueueConnection) QueueSender(javax.jms.QueueSender) InvalidDestinationException(javax.jms.InvalidDestinationException) Queue(javax.jms.Queue) QueueSession(javax.jms.QueueSession) Test(org.junit.Test)

Example 70 with QueueConnection

use of javax.jms.QueueConnection in project qpid-broker-j by apache.

the class QueueSenderTest method anonymousSenderSendToUnknownQueue.

@Test
public void anonymousSenderSendToUnknownQueue() throws Exception {
    QueueConnection connection = ((QueueConnection) getConnectionBuilder().setSyncPublish(true).build());
    try {
        QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
        Queue invalidDestination = session.createQueue("unknown");
        try {
            QueueSender sender = session.createSender(null);
            sender.send(invalidDestination, session.createMessage());
            fail("Exception not thrown");
        } catch (InvalidDestinationException e) {
        // PASS
        }
    } finally {
        connection.close();
    }
}
Also used : QueueConnection(javax.jms.QueueConnection) QueueSender(javax.jms.QueueSender) InvalidDestinationException(javax.jms.InvalidDestinationException) Queue(javax.jms.Queue) QueueSession(javax.jms.QueueSession) Test(org.junit.Test)

Aggregations

QueueConnection (javax.jms.QueueConnection)77 QueueSession (javax.jms.QueueSession)53 Test (org.junit.Test)41 TextMessage (javax.jms.TextMessage)36 Queue (javax.jms.Queue)33 Message (javax.jms.Message)26 MessageProducer (javax.jms.MessageProducer)20 QueueConnectionFactory (javax.jms.QueueConnectionFactory)20 Session (javax.jms.Session)17 JMSException (javax.jms.JMSException)16 InitialContext (javax.naming.InitialContext)15 QueueSender (javax.jms.QueueSender)14 XAQueueConnection (javax.jms.XAQueueConnection)14 ActiveMQRAConnectionFactory (org.apache.activemq.artemis.ra.ActiveMQRAConnectionFactory)14 ActiveMQRAConnectionFactoryImpl (org.apache.activemq.artemis.ra.ActiveMQRAConnectionFactoryImpl)14 ActiveMQRAManagedConnectionFactory (org.apache.activemq.artemis.ra.ActiveMQRAManagedConnectionFactory)14 QueueReceiver (javax.jms.QueueReceiver)13 MessageConsumer (javax.jms.MessageConsumer)12 ClientSession (org.apache.activemq.artemis.api.core.client.ClientSession)9 ClientMessage (org.apache.activemq.artemis.api.core.client.ClientMessage)6