Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Div
classconfluenceTableSmall
transactionCommitStrategy

Option

Required

Default Value

Description

connectionCount

 

1

The maximum number of connections available to endpoints started under this component

connectionFactory

(tick)

null

A ConnectionFactory is required to enable the SjmsComponent. It can be set directly or set set as part of a ConnectionResource.

connectionResource

 

null

A ConnectionResource is an interface that allows for customization and container control of the ConnectionFactory. See Plugable Connection Resource Management for further details.

headerFilterStrategy

 

DefaultJmsKeyFormatStrategy

 

keyFormatStrategy

 

DefaultJmsKeyFormatStrategy

 

Camel 2.15.x or older: See option below

jmsKeyFormatStrategy 

null

 

Below is an example of how to configure the SjmsComponent with its required ConnectionFactory provider. It will create a single connection by default and store it using the components internal pooling APIs to ensure that it is able to service Session creation requests in a thread safe manner.

Code Block
SjmsComponent component = new SjmsComponent();
component.setConnectionFactory(new ActiveMQConnectionFactory("tcp://localhost:61616"));
getContext().addComponent("sjms", component);

For a SjmsComponent that is required to support a durable subscription, you can override the default ConnectionFactoryResource instance and set the clientId property.

Code Block
ConnectionFactoryResource connectionResource = new ConnectionFactoryResource();
connectionResource.setConnectionFactory(new ActiveMQConnectionFactory("tcp://localhost:61616"));
connectionResource.setClientId("myclient-id");

SjmsComponent component = new SjmsComponent();
component.setConnectionResource(connectionResource);
component.setMaxConnections(1);

Producer Configuration Options

The SjmsProducer Endpoint supports the following properties:

DefaultJmsKeyFormatStrategyCamel 2.16: 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 theorg.apache.camel.component.jms.JmsKeyFormatStrategy and refer to it using the # notation.

transactionCommitStrategy

 

null

 

DestinationCreationStrategy DefaultDestinationCreationStrategyCamel 2.15.0: Support to set the custom DestinationCreationStrategy on the SJMS Component.
messageCreatedStrategy  Camel 2.16: 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.
completionPredicate  Camel 2.18: 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.
eagerCheckCompletion falseCamel 2.18: 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.

Below is an example of how to configure the SjmsComponent with its required ConnectionFactory provider. It will create a single connection by default and store it using the components internal pooling APIs to ensure that it is able to service Session creation requests in a thread safe manner.

Code Block
SjmsComponent component = new SjmsComponent();
component.setConnectionFactory(new ActiveMQConnectionFactory("tcp://localhost:61616"));
getContext().addComponent("sjms", component);

For a SjmsComponent that is required to support a durable subscription, you can override the default ConnectionFactoryResource instance and set the clientId property.

Code Block
ConnectionFactoryResource connectionResource = new ConnectionFactoryResource();
connectionResource.setConnectionFactory(new ActiveMQConnectionFactory("tcp://localhost:61616"));
connectionResource.setClientId("myclient-id");

SjmsComponent component = new SjmsComponent();
component.setConnectionResource(connectionResource);
component.setMaxConnections(1);

Producer Configuration Options

The SjmsProducer Endpoint supports the following properties:

Div
classconfluenceTableSmall

Option

Default Value

Description

acknowledgementMode

AUTO_ACKNOWLEDGE

The JMS acknowledgement name, which is one of: SESSION_TRANSACTED, AUTO_ACKNOWLEDGE or DUPS_OK_ACKNOWLEDGE. CLIENT_ACKNOWLEDGE is not supported at this time.

consumerCount

1

InOut only. Defines the number of MessageListener instances that for response consumers.

exchangePattern

InOnly

Sets the Producers message exchange pattern.

namedReplyTo

null

InOut only. Specifies a named reply to destination for responses.

persistent

true

Whether a message should be delivered with persistence enabled.

producerCount

1

Defines the number of MessageProducer instances.

responseTimeOut

5000

InOut only. Specifies the amount of time an InOut Producer will wait for its response.

synchronous

true

Sets whether the Endpoint will use synchronous or asynchronous processing.

transacted

false

If the endpoint should use a JMS Session transaction.

ttl

-1

Disabled by default. Sets the Message time to live header.

prefillPool
trueCamel 2.14: Whether to prefill the producer connection pool on startup, or create connections lazy when needed.
allowNullBodytrueCamel 2.15.1: Whether to allow sending messages with no body. If this option is false and the message body is null, then an JMSException is thrown.
mapJmsMessagetrueCamel 2.16: Specifies whether Camel should auto map the received JMS message to an appropiate payload type, such as javax.jms.TextMessage to a String etc. 
messageCreatedStrategy Camel 2.16: 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.
jmsKeyFormatStrategy Camel 2.16: 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 theorg.apache.camel.component.jms.JmsKeyFormatStrategy and refer to it using the # notation.
includeAllJMSXProperties Camel 2.16: 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
Div
classconfluenceTableSmall

Option

Default Value

Description

acknowledgementMode

AUTO_ACKNOWLEDGE

The JMS acknowledgement name, which is one of: SESSION_TRANSACTED, AUTO_ACKNOWLEDGE or DUPS_OK_ACKNOWLEDGE. CLIENT_ACKNOWLEDGE is not supported at this time.

consumerCount

1

InOut only. Defines the number of MessageListener instances that for response consumers.

exchangePattern

InOnly

Sets the Producers message exchange pattern.

namedReplyTo

null

InOut only. Specifies a named reply to destination for responses.

persistent

true

Whether a message should be delivered with persistence enabled.

producerCount

1

Defines the number of MessageProducer instances.

responseTimeOut

5000

InOut only. Specifies the amount of time an InOut Producer will wait for its response.

synchronous

true

Sets whether the Endpoint will use synchronous or asynchronous processing.

transacted

false

If the endpoint should use a JMS Session transaction.

ttl

-1

Disabled by default. Sets the Message time to live header.

prefillPool
trueCamel 2.14: Whether to prefill the producer connection pool on startup, or create connections lazy when needed.

Producer Usage

InOnly Producer - (Default)

...

To enable InOut behavior append the exchangePattern attribute to the URI. By default it will use a dedicated TemporaryQueue for each consumerURI. By default it will use a dedicated TemporaryQueue for each consumer.

Code Block
from("direct:start")
    .to("sjms:queue:bar?exchangePattern=InOut");

You can specify a namedReplyTo though which can provide a better monitor point.

Code Block
from("direct:start")
    .to("sjms:queue:bar?exchangePattern=InOut&namedReplyTo=my.reply.to.queue");

You can specify a namedReplyTo though which can provide a better monitor point.

Code Block
from("direct:start")
    .to("sjms:queue:bar?exchangePattern=InOut&namedReplyTo=my.reply.to.queue");

Consumers Configuration Options

The SjmsConsumer Endpoint supports the following properties:

Consumers Configuration Options

The SjmsConsumer Endpoint supports the following properties:

Div
classconfluenceTableSmall

Option

Default Value

Description

acknowledgementMode

AUTO_ACKNOWLEDGE

The JMS acknowledgement name, which is one of: TRANSACTED, AUTO_ACKNOWLEDGE or DUPS_OK_ACKNOWLEDGE. CLIENT_ACKNOWLEDGE is not supported at this time.

consumerCount

1

Defines the number of MessageListener instances.

durableSubscriptionId

null

Required for a durable subscriptions.

exchangePattern

InOnly

Sets the Consumers message exchange pattern.

messageSelector

null

Sets the message selector.

synchronous

true

Sets whether the Endpoint will use synchronous or asynchronous processing.

transacted

false

If the endpoint should use a JMS Session transaction.

transactionBatchCount

1

The number of exchanges to process before committing a local JMS transaction. The transacted property must also be set to true or this property will be ignored.

transactionBatchTimeout

5000

The amount of time a the transaction will stay open between messages before committing what has already been consumed. Minimum value is 1000ms.

ttl

-1

Disabled by default. Sets the Message time to live header.

asyncStartListenerfalse

Whether to startup the consumer message listener asynchronously, when starting a route. For example if a JmsConsumer cannot get a connection to a remote JMS broker, then it may block while retrying and/or failover. This will cause Camel to block while starting routes. By setting this option to true, you will let routes startup, while the JmsConsumer connects to the JMS broker using a dedicated thread in asynchronous mode. If this option is used, then beware that if the connection could not be established, then an exception is logged at WARN level, and the consumer will not be able to receive messages; You can then restart the route to retry.

asyncStopListenerfalseWhether to stop the consumer message listener asynchronously, when stopping a route
Div
classconfluenceTableSmall
Disabled by default. Sets the Message time to live header

Option

Default Value

Description

acknowledgementMode

AUTO_ACKNOWLEDGE

The JMS acknowledgement name, which is one of: TRANSACTED, AUTO_ACKNOWLEDGE or DUPS_OK_ACKNOWLEDGE. CLIENT_ACKNOWLEDGE is not supported at this time.

consumerCount

1

Defines the number of MessageListener instances.

durableSubscriptionId

null

Required for a durable subscriptions.

exchangePattern

InOnly

Sets the Consumers message exchange pattern.

messageSelector

null

Sets the message selector.

synchronous

true

Sets whether the Endpoint will use synchronous or asynchronous processing.

transacted

false

If the endpoint should use a JMS Session transaction.

transactionBatchCount

1

The number of exchanges to process before committing a local JMS transaction. The transacted property must also be set to true or this property will be ignored.

transactionBatchTimeout

5000

The amount of time a the transaction will stay open between messages before committing what has already been consumed. Minimum value is 1000ms.

ttl

-1

.

Consumer Usage

InOnly Consumer - (Default)

...