Class JmsSinkBuilder<T>

java.lang.Object
com.hazelcast.jet.pipeline.JmsSinkBuilder<T>
Type Parameters:
T - type of the items the sink accepts

public final class JmsSinkBuilder<T>
extends Object
Since:
3.0
  • Method Details

    • connectionParams

      @Nonnull public JmsSinkBuilder<T> connectionParams​(@Nullable String username, @Nullable String password)
      Sets the connection parameters. If connectionFn is provided, these parameters are ignored.
      Parameters:
      username - the username, Default value is null
      password - the password, Default value is null
    • connectionFn

      @Nonnull public JmsSinkBuilder<T> connectionFn​(@Nullable FunctionEx<javax.jms.ConnectionFactory,​javax.jms.Connection> connectionFn)
      Sets the function which creates a connection given a connection factory.

      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.
    • destinationName

      @Nonnull public JmsSinkBuilder<T> destinationName​(@Nonnull String destinationName)
      Sets the name of the destination.
    • messageFn

      @Nonnull public JmsSinkBuilder<T> messageFn​(@Nullable BiFunctionEx<javax.jms.Session,​T,​javax.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 a TextMessage, unless the item is already an instance of javax.jms.Message.

      The given function must be stateless.

    • exactlyOnce

      @Nonnull public JmsSinkBuilder<T> exactlyOnce​(boolean enable)
      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

      @Nonnull public Sink<T> build()
      Creates and returns the JMS Sink with the supplied components.