javax.jms.ConnectionConsumer Java Examples

The following examples show how to use javax.jms.ConnectionConsumer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ActiveMQRASessionFactoryImpl.java    From activemq-artemis with Apache License 2.0 6 votes vote down vote up
/**
 * Create a connection consumer -- throws IllegalStateException
 *
 * @param topic           The topic
 * @param messageSelector The message selector
 * @param sessionPool     The session pool
 * @param maxMessages     The number of max messages
 * @return The connection consumer
 * @throws JMSException Thrown if an error occurs
 */
@Override
public ConnectionConsumer createConnectionConsumer(final Topic topic,
                                                   final String messageSelector,
                                                   final ServerSessionPool sessionPool,
                                                   final int maxMessages) throws JMSException {
   if (ActiveMQRALogger.LOGGER.isTraceEnabled()) {
      ActiveMQRALogger.LOGGER.trace("createConnectionConsumer(" + topic +
                                       ", " +
                                       messageSelector +
                                       ", " +
                                       sessionPool +
                                       ", " +
                                       maxMessages +
                                       ")");
   }

   throw new IllegalStateException(ISE);
}
 
Example #2
Source File: ActiveMQConnection.java    From activemq-artemis with Apache License 2.0 6 votes vote down vote up
@Override
public ConnectionConsumer createDurableConnectionConsumer(final Topic topic,
                                                          final String subscriptionName,
                                                          final String messageSelector,
                                                          final ServerSessionPool sessionPool,
                                                          final int maxMessages) throws JMSException {
   checkClosed();
   // As spec. section 4.11
   if (connectionType == ActiveMQConnection.TYPE_QUEUE_CONNECTION) {
      String msg = "Cannot create a durable connection consumer on a QueueConnection";
      throw new javax.jms.IllegalStateException(msg);
   }
   checkTempQueues(topic);
   // We offer RA, so no need for this
   return null;
}
 
Example #3
Source File: ActiveMQRASessionFactoryImpl.java    From activemq-artemis with Apache License 2.0 6 votes vote down vote up
/**
 * Create a connection consumer -- throws IllegalStateException
 *
 * @param destination The destination
 * @param name        The name
 * @param pool        The session pool
 * @param maxMessages The number of max messages
 * @return The connection consumer
 * @throws JMSException Thrown if an error occurs
 */
@Override
public ConnectionConsumer createConnectionConsumer(final Destination destination,
                                                   final String name,
                                                   final ServerSessionPool pool,
                                                   final int maxMessages) throws JMSException {
   if (ActiveMQRALogger.LOGGER.isTraceEnabled()) {
      ActiveMQRALogger.LOGGER.trace("createConnectionConsumer(" + destination +
                                       ", " +
                                       name +
                                       ", " +
                                       pool +
                                       ", " +
                                       maxMessages +
                                       ")");
   }

   throw new IllegalStateException(ISE);
}
 
Example #4
Source File: ConnectionConsumerIntegrationTest.java    From qpid-jms with Apache License 2.0 6 votes vote down vote up
@Test(timeout = 20000)
public void testCreateConnectionConsumer() throws Exception {
    try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
        JmsServerSessionPool sessionPool = new JmsServerSessionPool();
        Connection connection = testFixture.establishConnecton(testPeer);

        // No additional Begin calls as there's no Session created for a Connection Consumer
        testPeer.expectReceiverAttach();
        testPeer.expectLinkFlow();

        Queue queue = new JmsQueue("myQueue");
        ConnectionConsumer consumer = connection.createConnectionConsumer(queue, null, sessionPool, 100);

        testPeer.expectDetach(true, true, true);
        consumer.close();

        testPeer.expectClose();
        connection.close();

        testPeer.waitForAllHandlersToComplete(1000);
    }
}
 
Example #5
Source File: ActiveMQRASessionFactoryImpl.java    From activemq-artemis with Apache License 2.0 6 votes vote down vote up
/**
 * Create a durable connection consumer -- throws IllegalStateException
 *
 * @param topic            The topic
 * @param subscriptionName The subscription name
 * @param messageSelector  The message selector
 * @param sessionPool      The session pool
 * @param maxMessages      The number of max messages
 * @return The connection consumer
 * @throws JMSException Thrown if an error occurs
 */
@Override
public ConnectionConsumer createDurableConnectionConsumer(final Topic topic,
                                                          final String subscriptionName,
                                                          final String messageSelector,
                                                          final ServerSessionPool sessionPool,
                                                          final int maxMessages) throws JMSException {
   if (ActiveMQRALogger.LOGGER.isTraceEnabled()) {
      ActiveMQRALogger.LOGGER.trace("createConnectionConsumer(" + topic +
                                       ", " +
                                       subscriptionName +
                                       ", " +
                                       messageSelector +
                                       ", " +
                                       sessionPool +
                                       ", " +
                                       maxMessages +
                                       ")");
   }

   throw new IllegalStateException(ISE);
}
 
Example #6
Source File: ManagedQueueConnection.java    From ats-framework with Apache License 2.0 5 votes vote down vote up
@Override
public ConnectionConsumer createConnectionConsumer(
                                                    Queue queue,
                                                    String messageSelector,
                                                    ServerSessionPool sessionPool,
                                                    int maxMessages ) throws JMSException {

    return addConnectionConsumer(queueConnection.createConnectionConsumer(queue,
                                                                          messageSelector,
                                                                          sessionPool,
                                                                          maxMessages));
}
 
Example #7
Source File: ProxyConnection.java    From lemon with Apache License 2.0 5 votes vote down vote up
public ConnectionConsumer createDurableConnectionConsumer(Topic topic,
        String subscriptionName, String messageSelector,
        ServerSessionPool sessionPool, int maxMessages) throws JMSException {
    this.checkStatus();

    return null;
}
 
Example #8
Source File: JmsConnection.java    From qpid-jms with Apache License 2.0 5 votes vote down vote up
@Override
public ConnectionConsumer createSharedDurableConnectionConsumer(Topic topic, String subscriptionName, String messageSelector, ServerSessionPool sessionPool, int maxMessages) throws JMSException {
    checkClosedOrFailed();
    createJmsConnection();

    return createConnectionConsumer(topic, messageSelector, sessionPool, maxMessages, subscriptionName, true, true);
}
 
Example #9
Source File: ProxyConnection.java    From lemon with Apache License 2.0 5 votes vote down vote up
public ConnectionConsumer createConnectionConsumer(Destination destination,
        String messageSelector, ServerSessionPool sessionPool,
        int maxMessages) throws JMSException {
    this.checkStatus();

    return null;
}
 
Example #10
Source File: JmsConnection.java    From qpid-jms with Apache License 2.0 5 votes vote down vote up
@Override
public ConnectionConsumer createDurableConnectionConsumer(Topic topic, String subscriptionName, String messageSelector, ServerSessionPool sessionPool, int maxMessages) throws JMSException {
    checkClosedOrFailed();
    createJmsConnection();

    return createConnectionConsumer(topic, messageSelector, sessionPool, maxMessages, subscriptionName, true, false);
}
 
Example #11
Source File: JmsConnection.java    From qpid-jms with Apache License 2.0 5 votes vote down vote up
@Override
public ConnectionConsumer createConnectionConsumer(Destination destination, String messageSelector, ServerSessionPool sessionPool, int maxMessages) throws JMSException {
    checkClosedOrFailed();
    createJmsConnection();

    return createConnectionConsumer(destination, messageSelector, sessionPool, maxMessages, null, false, false);
}
 
Example #12
Source File: ConnectionStub.java    From development with Apache License 2.0 5 votes vote down vote up
@Override
public ConnectionConsumer createSharedConnectionConsumer(Topic arg0,
        String arg1, String arg2, ServerSessionPool arg3, int arg4)
                throws JMSException {
    // TODO Auto-generated method stub
    return null;
}
 
Example #13
Source File: JmsConnection.java    From qpid-jms with Apache License 2.0 5 votes vote down vote up
@Override
public ConnectionConsumer createConnectionConsumer(Queue queue, String messageSelector, ServerSessionPool sessionPool, int maxMessages) throws JMSException {
    checkClosedOrFailed();
    createJmsConnection();

    return createConnectionConsumer(queue, messageSelector, sessionPool, maxMessages, null, false, false);
}
 
Example #14
Source File: ConnectionStub.java    From development with Apache License 2.0 5 votes vote down vote up
@Override
public ConnectionConsumer createSharedDurableConnectionConsumer(Topic arg0,
        String arg1, String arg2, ServerSessionPool arg3, int arg4)
                throws JMSException {
    // TODO Auto-generated method stub
    return null;
}
 
Example #15
Source File: TracingConnection.java    From brave with Apache License 2.0 5 votes vote down vote up
@JMS2_0
public ConnectionConsumer createSharedConnectionConsumer(Topic topic, String subscriptionName,
  String messageSelector, ServerSessionPool sessionPool, int maxMessages) throws JMSException {
  ConnectionConsumer cc =
    delegate.createSharedConnectionConsumer(topic, subscriptionName, messageSelector,
      sessionPool, maxMessages);
  return TracingConnectionConsumer.create(cc, jmsTracing);
}
 
Example #16
Source File: TracingConnection.java    From brave with Apache License 2.0 5 votes vote down vote up
@JMS2_0
public ConnectionConsumer createSharedDurableConnectionConsumer(Topic topic,
  String subscriptionName, String messageSelector, ServerSessionPool sessionPool,
  int maxMessages) throws JMSException {
  ConnectionConsumer cc =
    delegate.createSharedDurableConnectionConsumer(topic, subscriptionName, messageSelector,
      sessionPool, maxMessages);
  return TracingConnectionConsumer.create(cc, jmsTracing);
}
 
Example #17
Source File: ConnectionConsumerIntegrationTest.java    From qpid-jms with Apache License 2.0 5 votes vote down vote up
@Test(timeout = 20000)
public void testOnExceptionFiredOnSessionPoolFailure() throws Exception {
    final CountDownLatch exceptionFired = new CountDownLatch(1);

    try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
        Connection connection = testFixture.establishConnecton(testPeer);
        connection.setExceptionListener(new ExceptionListener() {

            @Override
            public void onException(JMSException exception) {
                exceptionFired.countDown();
            }
        });

        connection.start();

        JmsFailingServerSessionPool sessionPool = new JmsFailingServerSessionPool();

        // Now the Connection consumer arrives and we give it a message
        // to be dispatched to the server session.
        DescribedType amqpValueNullContent = new AmqpValueDescribedType(null);

        testPeer.expectReceiverAttach();
        testPeer.expectLinkFlowRespondWithTransfer(null, null, null, null, amqpValueNullContent);

        Queue queue = new JmsQueue("myQueue");
        ConnectionConsumer consumer = connection.createConnectionConsumer(queue, null, sessionPool, 100);

        assertTrue("Exception should have been fired", exceptionFired.await(5, TimeUnit.SECONDS));

        testPeer.expectDetach(true, true, true);
        testPeer.expectDispositionThatIsReleasedAndSettled();
        consumer.close();

        testPeer.expectClose();
        connection.close();

        testPeer.waitForAllHandlersToComplete(1000);
    }
}
 
Example #18
Source File: ActiveMQConnection.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
@Override
public ConnectionConsumer createSharedConnectionConsumer(Topic topic,
                                                         String subscriptionName,
                                                         String messageSelector,
                                                         ServerSessionPool sessionPool,
                                                         int maxMessages) throws JMSException {
   return null; // we offer RA
}
 
Example #19
Source File: ActiveMQConnection.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
@Override
public ConnectionConsumer createConnectionConsumer(final Queue queue,
                                                   final String messageSelector,
                                                   final ServerSessionPool sessionPool,
                                                   final int maxMessages) throws JMSException {
   checkClosed();
   checkTempQueues(queue);
   return null;
}
 
Example #20
Source File: ActiveMQConnection.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
@Override
public ConnectionConsumer createSharedDurableConnectionConsumer(Topic topic,
                                                                String subscriptionName,
                                                                String messageSelector,
                                                                ServerSessionPool sessionPool,
                                                                int maxMessages) throws JMSException {
   return null; // we offer RA
}
 
Example #21
Source File: ConnectionConsumerIntegrationTest.java    From qpid-jms with Apache License 2.0 5 votes vote down vote up
@Test(timeout = 20000)
public void testOnExceptionFiredOnServerSessionFailure() throws Exception {
    final CountDownLatch exceptionFired = new CountDownLatch(1);

    try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
        Connection connection = testFixture.establishConnecton(testPeer);
        connection.setExceptionListener(new ExceptionListener() {

            @Override
            public void onException(JMSException exception) {
                exceptionFired.countDown();
            }
        });

        connection.start();

        JmsServerSessionPool sessionPool = new JmsServerSessionPool(new JmsFailingServerSession());

        // Now the Connection consumer arrives and we give it a message
        // to be dispatched to the server session.
        DescribedType amqpValueNullContent = new AmqpValueDescribedType(null);

        testPeer.expectReceiverAttach();
        testPeer.expectLinkFlowRespondWithTransfer(null, null, null, null, amqpValueNullContent);

        Queue queue = new JmsQueue("myQueue");
        ConnectionConsumer consumer = connection.createConnectionConsumer(queue, null, sessionPool, 100);

        assertTrue("Exception should have been fired", exceptionFired.await(5, TimeUnit.SECONDS));

        testPeer.expectDetach(true, true, true);
        testPeer.expectDispositionThatIsReleasedAndSettled();
        consumer.close();

        testPeer.expectClose();
        connection.close();

        testPeer.waitForAllHandlersToComplete(1000);
    }
}
 
Example #22
Source File: ActiveMQRASessionFactoryImpl.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
@Override
public ConnectionConsumer createSharedDurableConnectionConsumer(Topic topic,
                                                                String subscriptionName,
                                                                String messageSelector,
                                                                ServerSessionPool sessionPool,
                                                                int maxMessages) throws JMSException {
   if (ActiveMQRALogger.LOGGER.isTraceEnabled()) {
      ActiveMQRALogger.LOGGER.trace("createSharedDurableConnectionConsumer(" + topic + ", " + subscriptionName +
                                       ", " + messageSelector + ", " + sessionPool + ", " + maxMessages + ")");
   }

   throw new IllegalStateException(ISE);
}
 
Example #23
Source File: ActiveMQRASessionFactoryImpl.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
@Override
public ConnectionConsumer createSharedConnectionConsumer(Topic topic,
                                                         String subscriptionName,
                                                         String messageSelector,
                                                         ServerSessionPool sessionPool,
                                                         int maxMessages) throws JMSException {
   if (ActiveMQRALogger.LOGGER.isTraceEnabled()) {
      ActiveMQRALogger.LOGGER.trace("createSharedConnectionConsumer(" + topic + ", " + subscriptionName + ", " +
                                       messageSelector + ", " + sessionPool + ", " + maxMessages + ")");
   }

   throw new IllegalStateException(ISE);
}
 
Example #24
Source File: ManagedTopicConnection.java    From ats-framework with Apache License 2.0 5 votes vote down vote up
@Override
public ConnectionConsumer createConnectionConsumer(
                                                    Topic topic,
                                                    String messageSelector,
                                                    ServerSessionPool sessionPool,
                                                    int maxMessages ) throws JMSException {

    return addConnectionConsumer(topicConnection.createConnectionConsumer(topic,
                                                                          messageSelector,
                                                                          sessionPool,
                                                                          maxMessages));
}
 
Example #25
Source File: ActiveMQRASessionFactoryImpl.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
/**
 * Create a connection consumer -- throws IllegalStateException
 *
 * @param destination The destination
 * @param pool        The session pool
 * @param maxMessages The number of max messages
 * @return The connection consumer
 * @throws JMSException Thrown if an error occurs
 */
public ConnectionConsumer createConnectionConsumer(final Destination destination,
                                                   final ServerSessionPool pool,
                                                   final int maxMessages) throws JMSException {
   if (ActiveMQRALogger.LOGGER.isTraceEnabled()) {
      ActiveMQRALogger.LOGGER.trace("createConnectionConsumer(" + destination +
                                       ", " +
                                       pool +
                                       ", " +
                                       maxMessages +
                                       ")");
   }

   throw new IllegalStateException(ISE);
}
 
Example #26
Source File: ManagedConnection.java    From ats-framework with Apache License 2.0 5 votes vote down vote up
@Override
public ConnectionConsumer createConnectionConsumer(
                                                    Destination destination,
                                                    String messageSelector,
                                                    ServerSessionPool sessionPool,
                                                    int maxMessages ) throws JMSException {

    return connection.createConnectionConsumer(destination, messageSelector, sessionPool, maxMessages);
}
 
Example #27
Source File: ManagedConnection.java    From ats-framework with Apache License 2.0 5 votes vote down vote up
@Override
public ConnectionConsumer createDurableConnectionConsumer(
                                                           Topic topic,
                                                           String subscriptionName,
                                                           String messageSelector,
                                                           ServerSessionPool sessionPool,
                                                           int maxMessages ) throws JMSException {

    return connection.createDurableConnectionConsumer(topic,
                                                      subscriptionName,
                                                      messageSelector,
                                                      sessionPool,
                                                      maxMessages);
}
 
Example #28
Source File: ManagedQueueTopicConnection.java    From ats-framework with Apache License 2.0 5 votes vote down vote up
@Override
public ConnectionConsumer createConnectionConsumer(
                                                    Topic topic,
                                                    String messageSelector,
                                                    ServerSessionPool sessionPool,
                                                    int maxMessages ) throws JMSException {

    return addConnectionConsumer( ((TopicConnection) connection).createConnectionConsumer(topic,
                                                                                          messageSelector,
                                                                                          sessionPool,
                                                                                          maxMessages));
}
 
Example #29
Source File: ManagedQueueTopicConnection.java    From ats-framework with Apache License 2.0 5 votes vote down vote up
@Override
public ConnectionConsumer createConnectionConsumer(
                                                    Queue queue,
                                                    String messageSelector,
                                                    ServerSessionPool sessionPool,
                                                    int maxMessages ) throws JMSException {

    return addConnectionConsumer( ((QueueConnection) connection).createConnectionConsumer(queue,
                                                                                          messageSelector,
                                                                                          sessionPool,
                                                                                          maxMessages));
}
 
Example #30
Source File: TomEEManagedConnectionProxy.java    From tomee with Apache License 2.0 4 votes vote down vote up
@Override
public ConnectionConsumer createSharedConnectionConsumer(final Topic topic, final String subscriptionName, final String messageSelector,
                                                         final ServerSessionPool sessionPool, final int maxMessages) throws JMSException {
    return connection.getPhysicalConnection().createSharedConnectionConsumer(topic, subscriptionName, messageSelector, sessionPool, maxMessages);
}