JMS Component
The JMS component allows messages to be sent to a JMS
Queue or Topic; or messages to be consumed from a JMS Queue or Topic. The implementation of the JMS Component uses Spring's JMS support for declarative transactions, using Spring's JmsTemplate for sending and a MessageListenerContainer for consuming.
URI format
jms:[topic:]destinationName?properties
So for example to send to queue FOO.BAR you would use
You can be completely specific if you wish via
If you want to send to a topic called Stocks.Prices then you would use
Notes
If you wish to use durable topic subscriptions, you need to specify both clientId and durableSubscriberName. Note that the value of the clientId must be unique and can only be used by a single JMS connection instance in your entire network. You may prefer to use Virtual Topics
instead to avoid this limitation. More background on durable messaging here
.
Properties
You can configure lots of different properties on the JMS endpoint which map to properties on the JMSConfiguration POJO
.
Property |
Default Value |
Description |
acceptMessagesWhileStopping |
false |
Should the consumer accept messages while it is stopping |
acknowledgementModeName |
"AUTO_ACKNOWLEDGE" |
The JMS acknowledgement name which is one of: TRANSACTED, CLIENT_ACKNOWLEDGE, AUTO_ACKNOWLEDGE, DUPS_OK_ACKNOWLEDGE |
autoStartup |
true |
Should the consumer container auto-startup |
cacheLevelName |
"CACHE_CONSUMER" |
Sets the cache level name for the underlying JMS resources |
clientId |
null |
Sets the JMS client ID to use. Note that this value if specified must be unique and can only be used by a single JMS connection instance. Its typically only required for durable topic subscriptions. You may prefer to use Virtual Topics instead |
concurrentConsumers |
1 |
Specifies the default number of concurrent consumers |
connectionFactory |
null |
The default JMS connection factory to use for the listenerConnectionFactory and templateConnectionFactory if neither are specified |
deliveryPersistent |
true |
Is persistent delivery used by default? |
durableSubscriptionName |
null |
The durable subscriber name for specifying durable topic subscriptions |
exceptionListener |
null |
The JMS Exception Listener used to be notified of any underlying JMS exceptions |
explicitQosEnabled |
false |
Set if the deliveryMode, priority or timeToLive should be used when sending messages |
exposeListenerSession |
true |
Set if the listener session should be exposed when consuming messages |
idleTaskExecutionLimit |
1 |
Specify the limit for idle executions of a receive task, not having received any message within its execution. If this limit is reached, the task will shut down and leave receiving to other executing tasks (in case of dynamic scheduling; see the "maxConcurrentConsumers" setting). |
listenerConnectionFactory |
null |
The JMS connection factory used for consuming messages |
maxConcurrentConsumers |
1 |
Specifies the maximum number of concurrent consumers |
maxMessagesPerTask |
1 |
The number of messages per task |
messageConverter |
null |
The Spring Message Converter |
messageIdEnabled |
true |
When sending, should message IDs be added |
messageTimestampEnabled |
true |
Should timestamps be enabled by default on sending messages |
priority |
-1 |
Values of > 1 specify the message priority when sending, if the explicitQosEnabled property is specified |
receiveTimeout |
none |
The timeout when receiving messages |
recoveryInterval |
none |
The recovery interval |
serverSessionFactory |
null |
The JMS ServerSessionFactory if you wish to use ServerSessionFactory for consumption |
subscriptionDurable |
false |
Enabled by default if you specify a durableSubscriberName and a clientId |
taskExecutor |
null |
Allows you to specify a custom task executor for consuming messages |
templateConnectionFactory |
null |
The JMS connection factory used for sending messages |
timeToLive |
null |
Is a time to live specified when sending messages |
transacted |
false |
Is transacted mode used for sending/receiving messages? |
transactionManager |
null |
The Spring transaction manager to use |
transactionName |
null |
The name of the transaction to use |
transactionTimeout |
null |
The timeout value of the transaction if using transacted mode |
useVersion102 |
false |
Should the old JMS API be used |
See Also