Simple JMS Batch

Simple JMS Batch

Scheme: sjms-batch
Syntax: sjms-batch:destinationName
Description: The sjms-batch component is a specialized for highly performant transactional batch consumption from a JMS queue.
Deprecated:false
ConsumerOnly:true
Async:false
Maven: org.apache.camel/camel-sjms/2.18.1.redhat-000034

The sjms-batch component is a specialized for highly performant, transactional batch consumption from a JMS queue.

Name Kind Group Required Default Type Enum Description
destinationName path consumer true java.lang.String The destination name. Only queues are supported, names may be prefixed by 'queue:'.
aggregationStrategy parameter consumer true org.apache.camel.processor.aggregate.AggregationStrategy The aggregation strategy to use, which merges all the batched messages into a single message
allowNullBody parameter consumer true boolean Whether to allow sending messages with no body. If this option is false and the message body is null, then an JMSException is thrown.
bridgeErrorHandler parameter consumer boolean Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN/ERROR level and ignored.
completionInterval parameter consumer 1000 int The completion interval in millis, which causes batches to be completed in a scheduled fixed rate every interval. The batch may be empty if the timeout triggered and there was no messages in the batch.
Notice you cannot use both completion timeout and completion interval at the same time, only one can be configured.
completionPredicate parameter consumer java.lang.String The completion predicate, which causes batches to be completed when the predicate evaluates as true.

The predicate can also be configured using the simple language using the string syntax. You may want to set the option eagerCheckCompletion to true to let the predicate match the incoming message, as otherwise it matches the aggregated message.

completionSize parameter consumer 200 int The number of messages consumed at which the batch will be completed
completionTimeout parameter consumer 500 int The timeout in millis from receipt of the first first message when the batch will be completed. The batch may be empty if the timeout triggered and there was no messages in the batch.
Notice you cannot use both completion timeout and completion interval at the same time, only one can be configured.
consumerCount parameter consumer 1 int The number of JMS sessions to consume from
eagerCheckCompletion parameter consumer boolean Use eager completion checking which means that the completionPredicate will use the incoming Exchange. As opposed to without eager completion checking the completionPredicate will use the aggregated Exchange.
includeAllJMSXProperties parameter consumer boolean Whether to include all JMSXxxx properties when mapping from JMS to Camel Message. Setting this to true will include properties such as JMSXAppID, and JMSXUserID etc. Note: If you are using a custom headerFilterStrategy then this option does not apply.
mapJmsMessage parameter consumer true boolean Specifies whether Camel should auto map the received JMS message to a suited payload type, such as javax.jms.TextMessage to a String etc. See section about how mapping works below for more details.
pollDuration parameter consumer 1000 int The duration in milliseconds of each poll for messages. completionTimeOut will be used if it is shorter and a batch has started.
sendEmptyMessageWhenIdle parameter consumer boolean If using completion timeout or interval, then the batch may be empty if the timeout triggered and there was no messages in the batch. If this option is true and the batch is empty then an empty message is added to the batch so an empty message is routed.
exceptionHandler parameter consumer (advanced) org.apache.camel.spi.ExceptionHandler To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this options is not in use. By default the consumer will deal with exceptions, that will be logged at WARN/ERROR level and ignored.
exchangePattern parameter consumer (advanced) org.apache.camel.ExchangePattern InOnly
RobustInOnly
InOut
InOptionalOut
OutOnly
RobustOutOnly
OutIn
OutOptionalIn
Sets the exchange pattern when the consumer creates an exchange.
headerFilterStrategy parameter advanced org.apache.camel.spi.HeaderFilterStrategy To use a custom HeaderFilterStrategy to filter header to and from Camel message.
jmsKeyFormatStrategy parameter advanced org.apache.camel.component.sjms.jms.JmsKeyFormatStrategy Pluggable strategy for encoding and decoding JMS keys so they can be compliant with the JMS specification. Camel provides two implementations out of the box: default and passthrough. The default strategy will safely marshal dots and hyphens (. and -). The passthrough strategy leaves the key as is. Can be used for JMS brokers which do not care whether JMS header keys contain illegal characters. You can provide your own implementation of the org.apache.camel.component.jms.JmsKeyFormatStrategy and refer to it using the # notation.
messageCreatedStrategy parameter advanced org.apache.camel.component.sjms.jms.MessageCreatedStrategy To use the given MessageCreatedStrategy which are invoked when Camel creates new instances of javax.jms.Message objects when Camel is sending a JMS message.
synchronous parameter advanced false boolean Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported).
timeoutCheckerExecutorService parameter advanced java.util.concurrent.ScheduledExecutorService If using the completionInterval option a background thread is created to trigger the completion interval. Set this option to provide a custom thread pool to be used rather than creating a new thread for every consumer.

sjms-batch consumer