T
- type of the items the sink acceptspublic final class JmsSinkBuilder<T> extends Object
Sinks.jmsQueueBuilder(com.hazelcast.function.SupplierEx<javax.jms.ConnectionFactory>)
or Sinks.jmsTopicBuilder(com.hazelcast.function.SupplierEx<javax.jms.ConnectionFactory>)
.Modifier and Type | Method and Description |
---|---|
Sink<T> |
build()
Creates and returns the JMS
Sink with the supplied components. |
JmsSinkBuilder<T> |
connectionFn(FunctionEx<javax.jms.ConnectionFactory,javax.jms.Connection> connectionFn)
Sets the function which creates a connection given a connection factory.
|
JmsSinkBuilder<T> |
connectionParams(String username,
String password)
Sets the connection parameters.
|
JmsSinkBuilder<T> |
destinationName(String destinationName)
Sets the name of the destination.
|
JmsSinkBuilder<T> |
exactlyOnce(boolean enable)
Enables or disables the exactly-once behavior of the sink using
two-phase commit of state snapshots.
|
JmsSinkBuilder<T> |
messageFn(BiFunctionEx<javax.jms.Session,T,javax.jms.Message> messageFn)
Sets the function which creates the message from the item.
|
@Nonnull public JmsSinkBuilder<T> connectionParams(@Nullable String username, @Nullable String password)
connectionFn
is provided, these
parameters are ignored.username
- the username, Default value is null
password
- the password, Default value is null
@Nonnull public JmsSinkBuilder<T> connectionFn(@Nullable FunctionEx<javax.jms.ConnectionFactory,javax.jms.Connection> connectionFn)
If not provided, the following will be used:
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();
}
The given function must be stateless.@Nonnull public JmsSinkBuilder<T> destinationName(@Nonnull String destinationName)
@Nonnull public JmsSinkBuilder<T> messageFn(@Nullable BiFunctionEx<javax.jms.Session,T,javax.jms.Message> messageFn)
If not provided, the builder creates a function which wraps item.toString()
into a TextMessage
, unless the item
is already an instance of javax.jms.Message
.
The given function must be stateless.
@Nonnull public JmsSinkBuilder<T> exactlyOnce(boolean enable)
The default value is true.
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-onceCopyright © 2023 Hazelcast, Inc.. All rights reserved.