Class JmsConnector
java.lang.Object
io.helidon.messaging.connectors.jms.JmsConnector
- All Implemented Interfaces:
Stoppable,ConnectorFactory,IncomingConnectorFactory,OutgoingConnectorFactory
- Direct Known Subclasses:
AqConnectorImpl,WeblogicConnector
@ApplicationScoped
public class JmsConnector
extends Object
implements IncomingConnectorFactory, OutgoingConnectorFactory, Stoppable
MicroProfile Reactive Messaging JMS connector.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringJMS acknowledge mode.static final StringWait for the acknowledgement of previous message before pulling next one.static final StringClient identifier for JMS connection.static final StringMicroprofile messaging JMS connector name.static final StringQueue or topic name.static final StringTrue for creating durable consumer (only for topic).static final StringJMS API message selector expression based on a subset of the SQL92.static final StringSelect in case factory is injected as a named bean or configured with name.static final StringIf 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.static final StringPassword used with ConnectionFactory.static final StringPeriod for executing poll cycles in millis.static final StringTimeout for polling for next message in every poll cycle in millis.static final StringWhen multiple channels share same session-group-id, they share same JMS session and same JDBC connection as well.static final StringSubscriber name for durable consumer used to identify subscription.static final StringIndicates whether the session will use a local transaction.static final StringPossible values are: queue, topic.static final StringUsername used with ConnectionFactory.Fields inherited from interface org.eclipse.microprofile.reactive.messaging.spi.ConnectorFactory
CHANNEL_NAME_ATTRIBUTE, CONNECTOR_ATTRIBUTE, CONNECTOR_PREFIX, INCOMING_PREFIX, OUTGOING_PREFIX -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedJmsConnector(Config config, Instance<jakarta.jms.ConnectionFactory> jakartaConnectionFactories) Create new JmsConnector.protectedJmsConnector(Map<String, jakarta.jms.ConnectionFactory> connectionFactoryMap, ScheduledExecutorService scheduler, ExecutorService executor) Create new JmsConnector. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Provides aJmsConnector.JmsConnectorBuilderfor creating aJmsConnectorinstance.static JmsConfigBuilderCustom config builder for JMS connector.protected CompletionStage<?> consumeAsync(Message<?> m, jakarta.jms.Session session, AtomicReference<MessageMapper> mapper, jakarta.jms.MessageProducer producer, Config config) static JmsConnectorcreate()Creates a new instance of JmsConnector with empty configuration.protected jakarta.jms.MessageConsumercreateConsumer(Config config, jakarta.jms.Destination destination, SessionMetadata sessionEntry) protected jakarta.jms.DestinationcreateDestination(jakarta.jms.Session session, ConnectionContext ctx) protected JmsMessage<?> createMessage(NackHandler nackHandler, jakarta.jms.Message message, Executor executor, SessionMetadata sessionMetadata) Create reactive messaging message from JMS message.protected jakarta.jms.MessageProducercreateProducer(jakarta.jms.Destination destination, ConnectionContext ctx, SessionMetadata sessionEntry) protected Optional<? extends jakarta.jms.ConnectionFactory> Find correct ConnectionFactory for channel.PublisherBuilder<? extends Message<?>> getPublisherBuilder(Config mpConfig) SubscriberBuilder<? extends Message<?>, Void> getSubscriberBuilder(Config mpConfig) protected SessionMetadataprepareSession(Config config, jakarta.jms.ConnectionFactory factory) protected BiConsumer<Message<?>, jakarta.jms.JMSException> sendingErrorHandler(Config config) Customizable handler for errors during sending.voidstop()Invoked duringMessaging.stop().
-
Field Details
-
CONNECTOR_NAME
Microprofile messaging JMS connector name.- See Also:
-
NAMED_FACTORY_ATTRIBUTE
Select in case factory is injected as a named bean or configured with name.- See Also:
-
USERNAME_ATTRIBUTE
Username used with ConnectionFactory.- See Also:
-
PASSWORD_ATTRIBUTE
Password used with ConnectionFactory.- See Also:
-
CLIENT_ID_ATTRIBUTE
Client identifier for JMS connection.- See Also:
-
DURABLE_ATTRIBUTE
True for creating durable consumer (only for topic).- See Also:
-
SUBSCRIBER_NAME_ATTRIBUTE
Subscriber name for durable consumer used to identify subscription.- See Also:
-
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
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
Indicates whether the session will use a local transaction.- See Also:
-
AWAIT_ACK_ATTRIBUTE
Wait for the acknowledgement of previous message before pulling next one.- See Also:
-
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
Timeout for polling for next message in every poll cycle in millis.- See Also:
-
PERIOD_EXECUTIONS_ATTRIBUTE
Period for executing poll cycles in millis.- See Also:
-
TYPE_ATTRIBUTE
Possible values are: queue, topic.- See Also:
-
DESTINATION_ATTRIBUTE
Queue or topic name.- See Also:
-
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 contextjakartaConnectionFactories- connection factory beans
-
JmsConnector
protected JmsConnector(Map<String, jakarta.jms.ConnectionFactory> connectionFactoryMap, ScheduledExecutorService scheduler, ExecutorService executor) Create new JmsConnector.- Parameters:
connectionFactoryMap- custom connection factoriesscheduler- custom scheduler for pollingexecutor- custom executor for async tasks
-
-
Method Details
-
builder
Provides aJmsConnector.JmsConnectorBuilderfor creating aJmsConnectorinstance.- Returns:
- new Builder instance
-
create
Creates a new instance of JmsConnector with empty configuration.- Returns:
- the new instance
-
configBuilder
Custom config builder for JMS connector.- Returns:
- new JMS specific config builder
-
stop
public void stop()Description copied from interface:StoppableInvoked duringMessaging.stop(). -
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 handlermessage- JMS messageexecutor- executor used for async execution of acksessionMetadata- JMS session metadata- Returns:
- reactive messaging message extended with custom JMS features
-
getFactory
Find correct ConnectionFactory for channel.- Parameters:
ctx- Channel's context- Returns:
- appropriate connection factory
-
getPublisherBuilder
- Specified by:
getPublisherBuilderin interfaceIncomingConnectorFactory
-
getSubscriberBuilder
- Specified by:
getSubscriberBuilderin interfaceOutgoingConnectorFactory
-
consumeAsync
protected CompletionStage<?> consumeAsync(Message<?> m, jakarta.jms.Session session, AtomicReference<MessageMapper> mapper, jakarta.jms.MessageProducer producer, Config config) -
sendingErrorHandler
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
-