Class JmsSyncConsumer

  • All Implemented Interfaces:
    AdaptrisComponent, AdaptrisMessageConsumer, AdaptrisMessageWorker, ComponentLifecycle, ComponentLifecycleExtension, JmsActorConfig, MessageEventGenerator, StateManagedComponent

    @ComponentProfile(summary="Pickup messages from a JMS broker (queue or topic) by actively polling it",
                      tag="consumer,jms",
                      recommended=JmsConnection.class)
    public class JmsSyncConsumer
    extends BaseJmsPollingConsumerImpl
    JMS synchronous consumer implementation that can target queues or topics via an RFC6167 style endpoint.

    For instance jms:queue:myQueueName will consume from a queue called myQueueName and jms:topic:myTopicName from a topic called myTopicName

    While RFC6167 defines the ability to use jndi to lookup the (as part of the 'jndi' variant section); this is not supported. There is also support for subscriptionId which indicates the subscriptionId that should be used when attaching a subscriber to a topic; jms:topic:MyTopicName?subscriptionId=myId would return a JmsDestination.subscriptionId() of myId. If a subscription ID is not specified, then a durable subscriber is never created; specifying a subscription ID automatically means a durable subscriber.

    Also supported is the JMS 2.0 sharedConsumerId, should you wish to create a multiple load balancing consumers on a single topic endpoint; jms:topic:MyTopicName?sharedConsumerId=12345

    For instance you could have the following destinations:
    • jms:queue:MyQueueName
    • jms:topic:MyTopicName
    • jms:topic:MyTopicName?subscriptionId=mySubscriptionId
    • jms:topic:MyTopicName?sharedConsumerId=mySharedConsumerId
    • jms:topic:MyTopicName?subscriptionId=mySubscriptionId&sharedConsumerId=mySharedConsumerId

    In the adapter configuration file this class is aliased as jms-poller which is the preferred alternative to the fully qualified classname when building your configuration.

    • Constructor Detail

      • JmsSyncConsumer

        public JmsSyncConsumer()
    • Method Detail

      • withEndpoint

        public JmsSyncConsumer withEndpoint​(java.lang.String s)
      • currentLogger

        public org.slf4j.Logger currentLogger()
        Description copied from interface: JmsActorConfig
        Return the configured logger.
        Returns:
        the logger.
      • messageSelector

        protected java.lang.String messageSelector()
      • endpoint

        protected java.lang.String endpoint()
      • createSession

        protected javax.jms.Session createSession​(int acknowledgeMode,
                                                  boolean transacted)
                                           throws javax.jms.JMSException
        Specified by:
        createSession in class BaseJmsPollingConsumerImpl
        Throws:
        javax.jms.JMSException
      • deferConsumerCreationToVendor

        protected java.lang.Boolean deferConsumerCreationToVendor()
      • getDeferConsumerCreationToVendor

        public java.lang.Boolean getDeferConsumerCreationToVendor()
        Set to true if you wish to let the JMS message consumer be delegated by the configured vendor implementation.

        The default is false such that we use standard JMS 1.1/2.0 methods to create the appropriate consumers.

      • setDeferConsumerCreationToVendor

        public void setDeferConsumerCreationToVendor​(java.lang.Boolean deferConsumerCreationToVendor)
        Set to true if you wish to let the JMS message consumer be delegated by the configured vendor implementation.

        The default is false such that we use standard JMS 1.1/2.0 methods to create the appropriate consumers.

      • getEndpoint

        @NonNull
        public @NonNull java.lang.String getEndpoint()
        The RFC6167 format topic/queue.
      • setEndpoint

        public void setEndpoint​(@NonNull
                                @NonNull java.lang.String endpoint)
        The RFC6167 format topic/queue.