public final class JmsSourceBuilder extends Object
Sources.jmsQueueBuilder(com.hazelcast.function.SupplierEx<? extends javax.jms.ConnectionFactory>)or
Sources.jmsTopicBuilder(com.hazelcast.function.SupplierEx<? extends javax.jms.ConnectionFactory>).
|Modifier and Type||Method and Description|
Creates and returns the JMS
Sets the function which creates the connection using the connection factory.
Sets the connection parameters.
Sets the function which creates the message consumer from session.
Sets the name of the destination (name of the topic or queue).
Sets the maximum processing guarantee for the source.
Configures the function to extract IDs from the messages, if exactly-once guarantee is used.
Specifies whether the MessageConsumer of the JMS topic is shared, that is whether
@Nonnull public JmsSourceBuilder connectionParams(@Nullable String username, @Nullable String password)
connectionFn(FunctionEx)is set, these parameters are ignored.
@Nonnull public JmsSourceBuilder connectionFn(@Nullable com.hazelcast.function.FunctionEx<? super javax.jms.ConnectionFactory,? extends javax.jms.Connection> connectionFn)
If not provided, this function is used:
connectionFn = factory -> username != null || password != null ? factory.createConnection(usernameLocal, passwordLocal) : factory.createConnection()The user name and password set with
connectionParams(java.lang.String, java.lang.String)are used.
@Nonnull public JmsSourceBuilder destinationName(@Nullable String destinationName)
consumerFn(FunctionEx)is provided, this parameter is ignored.
@Nonnull public JmsSourceBuilder consumerFn(@Nullable com.hazelcast.function.FunctionEx<? super javax.jms.Session,? extends javax.jms.MessageConsumer> consumerFn)
If not provided,
Session#createConsumer(destinationName) is used
to create the consumer. See
If you're consuming a topic and you create a shared consumer, make
sure to also call
@Nonnull public JmsSourceBuilder messageIdFn(@Nonnull com.hazelcast.function.FunctionEx<? super javax.jms.Message,?> messageIdFn)
Make sure the function returns non-null for every message, or the job
will fail. The returned object should also implement
hashCode() methods. If you don't have a unique message ID,
reduce the guarantee to
The default is to use
@Nonnull public JmsSourceBuilder maxGuarantee(@Nonnull ProcessingGuarantee guarantee)
If the processing guarantee is NONE, the processor will consume the
Session.DUPS_OK_ACKNOWLEDGE mode. If the processing
guarantee is other than NONE, the processor will acknowledge messages in
transactions in the 2nd phase of the snapshot, that is after all
downstream stages fully processed the messages. Additionally, if the
processing guarantee is EXACTLY_ONCE, the processor will store
message IDs of the unacknowledged
messages to the snapshot and should the job fail after the snapshot was
successful, but before Jet managed to acknowledge the messages. The
stored IDs will be used to filter out the re-delivered messages.
If you use a non-durable consumer with a topic, the guarantee will not
work since the broker doesn't store the messages at all. You can also
set the max-guarantee to NONE in this case - the acknowledge operation
is ignored anyway. If you didn't specify your own
consumerFn(FunctionEx), a non-durable consumer is created for a topic
The default is
ProcessingGuarantee.EXACTLY_ONCE, which means
that the source's guarantee will match the job's guarantee.
@Nonnull public JmsSourceBuilder sharedConsumer(boolean isSharedConsumer)
createSharedDurableConsumer()was used to create it in the
If the consumer is not shared, only a single processor on a single
member will connect to the broker to receive the messages. If you set
this parameter to
true for a non-shared consumer, all messages
will be emitted on every member, leading to duplicate processing.
A consumer for a queue is always assumed to be shared, regardless of this setting.
The default value is
@Nonnull public <T> StreamSource<T> build(@Nonnull com.hazelcast.function.FunctionEx<? super javax.jms.Message,? extends T> projectionFn)
StreamSourcewith the supplied components and the projection function
T- the type of the items the source emits
projectionFn- the function which creates output object from each message
Copyright © 2020 Hazelcast, Inc.. All rights reserved.