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 Modifier and Type Class Description static classJmsConnector.JmsConnectorBuilderBuilder forJmsConnector.
-
Field Summary
Fields Modifier and Type Field Description protected static StringCLIENT_ID_ATTRIBUTEClient identifier for JMS connection.static StringCONNECTOR_NAMEMicroprofile messaging JMS connector name.protected static StringDURABLE_ATTRIBUTETrue for creating durable consumer (only for topic).protected static StringNAMED_FACTORY_ATTRIBUTESelect in case factory is injected as a named bean or configured with name.protected static StringNON_LOCAL_ATTRIBUTEIf 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 StringPASSWORD_ATTRIBUTEPassword used with ConnectionFactory.protected static StringSUBSCRIBER_NAME_ATTRIBUTESubscriber name for durable consumer used to identify subscription.protected static StringUSERNAME_ATTRIBUTEUser 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
Constructors Modifier Constructor Description protectedJmsConnector(Config config, Instance<javax.jms.ConnectionFactory> connectionFactories)Create new JmsConnector.protectedJmsConnector(Map<String,javax.jms.ConnectionFactory> connectionFactoryMap, ScheduledExecutorService scheduler, ExecutorService executor)Create new JmsConnector.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static JmsConnector.JmsConnectorBuilderbuilder()Provides aJmsConnector.JmsConnectorBuilderfor creating aJmsConnectorinstance.static JmsConfigBuilderconfigBuilder()Custom config builder for JMS connector.static JmsConnectorcreate()Creates a new instance of JmsConnector with empty configuration.protected JmsMessage<?>createMessage(javax.jms.Message message, Executor executor, SessionMetadata sessionMetadata)Create reactive messaging message from JMS message.protected Optional<? extends javax.jms.ConnectionFactory>getFactory(ConnectionContext ctx)Find correct ConnectionFactory for channel.PublisherBuilder<? extends Message<?>>getPublisherBuilder(Config mpConfig)SubscriberBuilder<? extends Message<?>,Void>getSubscriberBuilder(Config mpConfig)protected BiConsumer<Message<?>,javax.jms.JMSException>sendingErrorHandler(Config config)Customizable handler for errors during sending.voidstop()Invoked duringMessaging.stop().
-
-
-
Field Detail
-
CONNECTOR_NAME
public static final String CONNECTOR_NAME
Microprofile messaging JMS connector name.- See Also:
- Constant Field Values
-
NAMED_FACTORY_ATTRIBUTE
protected static final String NAMED_FACTORY_ATTRIBUTE
Select in case factory is injected as a named bean or configured with name.- See Also:
- Constant Field Values
-
USERNAME_ATTRIBUTE
protected static final String USERNAME_ATTRIBUTE
User name used with ConnectionFactory.- See Also:
- Constant Field Values
-
PASSWORD_ATTRIBUTE
protected static final String PASSWORD_ATTRIBUTE
Password used with ConnectionFactory.- See Also:
- Constant Field Values
-
CLIENT_ID_ATTRIBUTE
protected static final String CLIENT_ID_ATTRIBUTE
Client identifier for JMS connection.- See Also:
- Constant Field Values
-
DURABLE_ATTRIBUTE
protected static final String DURABLE_ATTRIBUTE
True for creating durable consumer (only for topic).- See Also:
- Constant Field Values
-
SUBSCRIBER_NAME_ATTRIBUTE
protected static final String SUBSCRIBER_NAME_ATTRIBUTE
Subscriber name for durable consumer used to identify subscription.- See Also:
- Constant Field Values
-
NON_LOCAL_ATTRIBUTE
protected 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:
- Constant Field Values
-
-
Constructor Detail
-
JmsConnector
@Inject protected JmsConnector(Config config, Instance<javax.jms.ConnectionFactory> connectionFactories)
Create new JmsConnector.- Parameters:
connectionFactories- connection factory beansconfig- root config for thread context
-
JmsConnector
protected JmsConnector(Map<String,javax.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 Detail
-
builder
public static JmsConnector.JmsConnectorBuilder builder()
Provides aJmsConnector.JmsConnectorBuilderfor creating aJmsConnectorinstance.- 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:StoppableInvoked duringMessaging.stop().
-
createMessage
protected JmsMessage<?> createMessage(javax.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
protected Optional<? extends javax.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:
getPublisherBuilderin interfaceIncomingConnectorFactory
-
getSubscriberBuilder
public SubscriberBuilder<? extends Message<?>,Void> getSubscriberBuilder(Config mpConfig)
- Specified by:
getSubscriberBuilderin interfaceOutgoingConnectorFactory
-
sendingErrorHandler
protected BiConsumer<Message<?>,javax.jms.JMSException> sendingErrorHandler(Config config)
Customizable handler for errors during sending.- Parameters:
config- channel's config- Returns:
- consumer of errors
-
-