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

      public final class JmsSinkBuilder<T>
      extends Object

  See `Sinks.jmsQueueBuilder(com.hazelcast.jet.function.DistributedSupplier<javax.jms.ConnectionFactory>)` or `Sinks.jmsTopicBuilder(com.hazelcast.jet.function.DistributedSupplier<javax.jms.ConnectionFactory>)`.

- - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Sink<T>` | `build()` Creates and returns the JMS `Sink` with the supplied components.
    `JmsSinkBuilder<T>` | `connectionFn(DistributedFunction<javax.jms.ConnectionFactory,javax.jms.Connection> connectionFn)` Sets the function which creates the connection from 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>` | `flushFn(DistributedConsumer<javax.jms.Session> flushFn)` Sets the function which flushes the session after a batch of messages is sent.
    `JmsSinkBuilder<T>` | `messageFn(DistributedBiFunction<javax.jms.Session,T,javax.jms.Message> messageFn)` Sets the function which creates the message from the item.
    `JmsSinkBuilder<T>` | `sendFn(DistributedBiConsumer<javax.jms.MessageProducer,javax.jms.Message> sendFn)` Sets the function which sends the message via message producer.
    `JmsSinkBuilder<T>` | `sessionFn(DistributedFunction<javax.jms.Connection,javax.jms.Session> sessionFn)` Sets the function which creates a session from a connection.
    `JmsSinkBuilder<T>` | `sessionParams(boolean transacted, int acknowledgeMode)` Sets the session parameters.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### connectionParams

          public JmsSinkBuilder<T> connectionParams(String username,
                                                    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

          public JmsSinkBuilder<T> connectionFn(@Nonnull
                                                DistributedFunction<javax.jms.ConnectionFactory,javax.jms.Connection> connectionFn)

      Sets the function which creates the connection from connection factory.

      If not provided, the builder creates a function which uses `ConnectionFactory#createConnection(username, password)` to create the connection. See `connectionParams(String, String)`.

    - #### sessionParams

          public JmsSinkBuilder<T> sessionParams(boolean transacted,
                                                 int acknowledgeMode)

      Sets the session parameters. If `sessionFn` is provided, these parameters are ignored.
      Parameters:
        `transacted` - if true, marks the session as transacted. Default value is false.
        `acknowledgeMode` - sets the acknowledge mode of the session, Default value is `Session.AUTO_ACKNOWLEDGE`

    - #### sessionFn

          public JmsSinkBuilder<T> sessionFn(@Nonnull
                                             DistributedFunction<javax.jms.Connection,javax.jms.Session> sessionFn)

      Sets the function which creates a session from a connection.

      If not provided, the builder creates a function which uses `Connection#createSession(boolean transacted, int acknowledgeMode)` to create the session. See `sessionParams(boolean, int)`.

    - #### destinationName

          public JmsSinkBuilder<T> destinationName(@Nonnull
                                                   String destinationName)

      Sets the name of the destination.

    - #### messageFn

          public JmsSinkBuilder<T> messageFn(DistributedBiFunction<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`.

    - #### sendFn

          public JmsSinkBuilder<T> sendFn(DistributedBiConsumer<javax.jms.MessageProducer,javax.jms.Message> sendFn)

      Sets the function which sends the message via message producer.

      If not provided, the builder creates a function which sends the message via `MessageProducer#send(Message message)`.

    - #### flushFn

          public JmsSinkBuilder<T> flushFn(DistributedConsumer<javax.jms.Session> flushFn)

      Sets the function which flushes the session after a batch of messages is sent.

      If not provided, the builder creates a no-op consumer.

    - #### build

          public Sink<T> build()

      Creates and returns the JMS `Sink` with the supplied components.

Copyright © 2018. All rights reserved.