Class JmsConnector
java.lang.Object
io.helidon.messaging.connectors.jms.JmsConnector
- All Implemented Interfaces:
Stoppable,ConnectorFactory,IncomingConnectorFactory,OutgoingConnectorFactory
- Direct Known Subclasses:
AqConnectorImpl
@ApplicationScoped
public class JmsConnector
extends Object
implements IncomingConnectorFactory, OutgoingConnectorFactory, Stoppable
MicroProfile Reactive Messaging JMS connector.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final StringClient identifier for JMS connection.static final StringMicroprofile messaging JMS connector name.protected static final StringTrue for creating durable consumer (only for topic).protected static final StringSelect in case factory is injected as a named bean or configured with name.protected 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.protected static final StringPassword used with ConnectionFactory.protected static final StringSubscriber name for durable consumer used to identify subscription.protected static final StringUser name 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> connectionFactories) 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.static JmsConnectorcreate()Creates a new instance of JmsConnector with empty configuration.protected JmsMessage<?>createMessage(jakarta.jms.Message message, Executor executor, SessionMetadata sessionMetadata) Create reactive messaging message from JMS message.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 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
User name 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:
-
-
Constructor Details
-
JmsConnector
@Inject protected JmsConnector(Config config, Instance<jakarta.jms.ConnectionFactory> connectionFactories) Create new JmsConnector.- Parameters:
connectionFactories- connection factory beansconfig- root config for thread context
-
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(jakarta.jms.Message message, Executor executor, SessionMetadata sessionMetadata) Create reactive messaging message from JMS message.- Parameters:
message- 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
-
sendingErrorHandler
Customizable handler for errors during sending.- Parameters:
config- channel's config- Returns:
- consumer of errors
-