Package com.hazelcast.jet.pipeline
Class JmsSinkBuilder<T>
java.lang.Object
com.hazelcast.jet.pipeline.JmsSinkBuilder<T>
- Type Parameters:
T
- type of the items the sink accepts
See
Sinks.jmsQueueBuilder(com.hazelcast.function.SupplierEx<jakarta.jms.ConnectionFactory>)
or Sinks.jmsTopicBuilder(com.hazelcast.function.SupplierEx<jakarta.jms.ConnectionFactory>)
.- Since:
- Jet 3.0
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Creates and returns the JMSSink
with the supplied components.connectionFn
(FunctionEx<jakarta.jms.ConnectionFactory, jakarta.jms.Connection> connectionFn) Sets the function which creates a connection given a connection factory.connectionParams
(String username, String password) Sets the connection parameters.destinationName
(String destinationName) Sets the name of the destination.exactlyOnce
(boolean enable) Enables or disables the exactly-once behavior of the sink using two-phase commit of state snapshots.messageFn
(BiFunctionEx<jakarta.jms.Session, T, jakarta.jms.Message> messageFn) Sets the function which creates the message from the item.
-
Method Details
-
connectionParams
@Nonnull public JmsSinkBuilder<T> connectionParams(@Nullable String username, @Nullable String password) Sets the connection parameters. IfconnectionFn
is provided, these parameters are ignored.- Parameters:
username
- the username, Default value isnull
password
- the password, Default value isnull
-
connectionFn
@Nonnull public JmsSinkBuilder<T> connectionFn(@Nullable FunctionEx<jakarta.jms.ConnectionFactory, jakarta.jms.Connection> connectionFn) Sets the function which creates a connection given a connection factory.If not provided, the following will be used:
The given function must be stateless.if (factory instanceof XAConnectionFactory) { XAConnectionFactory xaFactory = (XAConnectionFactory) factory; return usernameLocal != null || passwordLocal != null ? xaFactory.createXAConnection(usernameLocal, passwordLocal) : xaFactory.createXAConnection(); } else { return usernameLocal != null || passwordLocal != null ? factory.createConnection(usernameLocal, passwordLocal) : factory.createConnection(); }
-
destinationName
Sets the name of the destination. -
messageFn
@Nonnull public JmsSinkBuilder<T> messageFn(@Nullable BiFunctionEx<jakarta.jms.Session, T, jakarta.jms.Message> messageFn) Sets the function which creates the message from the item.If not provided, the builder creates a function which wraps
item.toString()
into aTextMessage
, unless the item is already an instance ofjavax.jms.Message
.The given function must be stateless.
-
exactlyOnce
Enables or disables the exactly-once behavior of the sink using two-phase commit of state snapshots. If enabled, the processing guarantee of the job must be set to exactly-once, otherwise the sink's guarantee will match that of the job. In other words, sink's guarantee cannot be higher than job's, but can be lower to avoid the additional overhead.The default value is true.
- Parameters:
enable
- If true, sink's guarantee will match the job guarantee. If false, sink's guarantee will be at-least-once even if job's is exactly-once- Returns:
- this instance for fluent API
-
build
Creates and returns the JMSSink
with the supplied components.
-