java.lang.Object
io.helidon.messaging.connectors.jms.JmsConnector
All Implemented Interfaces:
Stoppable, ConnectorFactory, IncomingConnectorFactory, OutgoingConnectorFactory
Direct Known Subclasses:
AqConnectorImpl, WeblogicConnector

MicroProfile Reactive Messaging JMS connector.
  • Field Details

    • CONNECTOR_NAME

      public static final String CONNECTOR_NAME
      Microprofile messaging JMS connector name.
      See Also:
    • NAMED_FACTORY_ATTRIBUTE

      public static final String NAMED_FACTORY_ATTRIBUTE
      Select in case factory is injected as a named bean or configured with name.
      See Also:
    • USERNAME_ATTRIBUTE

      public static final String USERNAME_ATTRIBUTE
      Username used with ConnectionFactory.
      See Also:
    • PASSWORD_ATTRIBUTE

      public static final String PASSWORD_ATTRIBUTE
      Password used with ConnectionFactory.
      See Also:
    • CLIENT_ID_ATTRIBUTE

      public static final String CLIENT_ID_ATTRIBUTE
      Client identifier for JMS connection.
      See Also:
    • DURABLE_ATTRIBUTE

      public static final String DURABLE_ATTRIBUTE
      True for creating durable consumer (only for topic).
      See Also:
    • SUBSCRIBER_NAME_ATTRIBUTE

      public static final String SUBSCRIBER_NAME_ATTRIBUTE
      Subscriber name for durable consumer used to identify subscription.
      See Also:
    • NON_LOCAL_ATTRIBUTE

      public static final String NON_LOCAL_ATTRIBUTE
      If true then any messages published to the topic using this session's connection, or any other connection with the same client identifier, will not be added to the durable subscription.
      See Also:
    • ACK_MODE_ATTRIBUTE

      public static final String ACK_MODE_ATTRIBUTE
      JMS acknowledge mode.

      Possible values are:

      • AUTO_ACKNOWLEDGE - session automatically acknowledges a client’s receipt of a message,
      • CLIENT_ACKNOWLEDGE - receipt of a message is acknowledged only when Message.ack() is called manually,
      • DUPS_OK_ACKNOWLEDGE - session lazily acknowledges the delivery of messages.
      See Also:
    • TRANSACTED_ATTRIBUTE

      public static final String TRANSACTED_ATTRIBUTE
      Indicates whether the session will use a local transaction.
      See Also:
    • AWAIT_ACK_ATTRIBUTE

      public static final String AWAIT_ACK_ATTRIBUTE
      Wait for the acknowledgement of previous message before pulling next one.
      See Also:
    • MESSAGE_SELECTOR_ATTRIBUTE

      public static final String MESSAGE_SELECTOR_ATTRIBUTE
      JMS API message selector expression based on a subset of the SQL92. Expression can only access headers and properties, not the payload.
      See Also:
    • POLL_TIMEOUT_ATTRIBUTE

      public static final String POLL_TIMEOUT_ATTRIBUTE
      Timeout for polling for next message in every poll cycle in millis.
      See Also:
    • PERIOD_EXECUTIONS_ATTRIBUTE

      public static final String PERIOD_EXECUTIONS_ATTRIBUTE
      Period for executing poll cycles in millis.
      See Also:
    • TYPE_ATTRIBUTE

      public static final String TYPE_ATTRIBUTE
      Possible values are: queue, topic.
      See Also:
    • DESTINATION_ATTRIBUTE

      public static final String DESTINATION_ATTRIBUTE
      Queue or topic name.
      See Also:
    • SESSION_GROUP_ID_ATTRIBUTE

      public static final String SESSION_GROUP_ID_ATTRIBUTE
      When multiple channels share same session-group-id, they share same JMS session and same JDBC connection as well.
      See Also:
  • Constructor Details

    • JmsConnector

      @Inject protected JmsConnector(Config config, Instance<jakarta.jms.ConnectionFactory> jakartaConnectionFactories)
      Create new JmsConnector.
      Parameters:
      config - root config for thread context
      jakartaConnectionFactories - connection factory beans
    • JmsConnector

      protected JmsConnector(Map<String,jakarta.jms.ConnectionFactory> connectionFactoryMap, ScheduledExecutorService scheduler, ExecutorService executor)
      Create new JmsConnector.
      Parameters:
      connectionFactoryMap - custom connection factories
      scheduler - custom scheduler for polling
      executor - custom executor for async tasks
  • Method Details

    • builder

      public static JmsConnector.JmsConnectorBuilder builder()
      Provides a JmsConnector.JmsConnectorBuilder for creating a JmsConnector instance.
      Returns:
      new Builder instance
    • create

      public static JmsConnector create()
      Creates a new instance of JmsConnector with empty configuration.
      Returns:
      the new instance
    • configBuilder

      public static JmsConfigBuilder configBuilder()
      Custom config builder for JMS connector.
      Returns:
      new JMS specific config builder
    • stop

      public void stop()
      Description copied from interface: Stoppable
      Invoked during Messaging.stop().
      Specified by:
      stop in interface Stoppable
    • createMessage

      protected JmsMessage<?> createMessage(NackHandler nackHandler, jakarta.jms.Message message, Executor executor, SessionMetadata sessionMetadata)
      Create reactive messaging message from JMS message.
      Parameters:
      nackHandler - Not acknowledged handler
      message - JMS message
      executor - executor used for async execution of ack
      sessionMetadata - JMS session metadata
      Returns:
      reactive messaging message extended with custom JMS features
    • getFactory

      protected Optional<? extends jakarta.jms.ConnectionFactory> getFactory(ConnectionContext ctx)
      Find correct ConnectionFactory for channel.
      Parameters:
      ctx - Channel's context
      Returns:
      appropriate connection factory
    • getPublisherBuilder

      public PublisherBuilder<? extends Message<?>> getPublisherBuilder(Config mpConfig)
      Specified by:
      getPublisherBuilder in interface IncomingConnectorFactory
    • getSubscriberBuilder

      public SubscriberBuilder<? extends Message<?>,Void> getSubscriberBuilder(Config mpConfig)
      Specified by:
      getSubscriberBuilder in interface OutgoingConnectorFactory
    • consumeAsync

      protected CompletionStage<?> consumeAsync(Message<?> m, jakarta.jms.Session session, AtomicReference<MessageMapper> mapper, jakarta.jms.MessageProducer producer, Config config)
    • sendingErrorHandler

      protected BiConsumer<Message<?>,jakarta.jms.JMSException> sendingErrorHandler(Config config)
      Customizable handler for errors during sending.
      Parameters:
      config - channel's config
      Returns:
      consumer of errors
    • prepareSession

      protected SessionMetadata prepareSession(Config config, jakarta.jms.ConnectionFactory factory) throws jakarta.jms.JMSException
      Throws:
      jakarta.jms.JMSException
    • createDestination

      protected jakarta.jms.Destination createDestination(jakarta.jms.Session session, ConnectionContext ctx)
    • createConsumer

      protected jakarta.jms.MessageConsumer createConsumer(Config config, jakarta.jms.Destination destination, SessionMetadata sessionEntry) throws jakarta.jms.JMSException
      Throws:
      jakarta.jms.JMSException
    • createProducer

      protected jakarta.jms.MessageProducer createProducer(jakarta.jms.Destination destination, ConnectionContext ctx, SessionMetadata sessionEntry) throws jakarta.jms.JMSException
      Throws:
      jakarta.jms.JMSException