JMS Namespace Support Spring - Java-Springs

The namespace consists of two top-level elements: <listener-container/> and <jca-listener-container/> both of which may contain one or more <listener/> child elements. Here is an example of a basic configuration for two listeners.

<jms:listener-container>
<jms:listener destination="queue.orders" ref="orderService" method="placeOrder"/>
<jms:listener destination="queue.confirmations" ref="confirmationLogger" method="log"/>
</jms:listener-container>

The example above is equivalent to creating two distinct listener container bean definitions and two distinct MessageListenerAdapter bean definitions. In addition to the attributes shown above, the listener element may contain several optional ones. The following table describes all available attributes:

Table Attributes of the JMS <listener> element

Attributes of the JMS <listener> elementAttributes of the JMS <listener> element

The <listener-container/> element also accepts several optional attributes.This allows for customization of the various strategies (for example, task Executor and destination Resolver) as well as basic JMS settings and resource references.Using these attributes, it is possible to define highly-customized listener containers while still benefiting from the convenience of the namespace.

<jms:listener-container connection-factory="myConnectionFactory"
task-executor="myTaskExecutor"
destination-resolver="myDestinationResolver"
transaction-manager="myTransactionManager"
concurrency="10">
<jms:listener destination="queue.orders" ref="orderService" method="placeOrder"/>
<jms:listener destination="queue.confirmations" ref="confirmationLogger" method="log"/>
</jms:listener-container>

The following table describes all available attributes. Consult the class-level Javadoc of the AbstractMessageListenerContainer and its concrete subclasses for more detail on the individual properties.The Javadoc also provides a discussion of transaction choices and message redelivery scenarios.

Table Attributes of the JMS <listener-container> element

Attributes of the JMS listener-container elementAttributes of the JMS listener-container elementAttributes of the JMS listener-container elementAttributes of the JMS listener-container element

Configuring a JCA-based listener container with the "jms" schema support is very similar.

<jms:jca-listener-container resource-adapter="myResourceAdapter"
destination-resolver="myDestinationResolver"
transaction-manager="myTransactionManager"
concurrency="10">
<jms:listener destination="queue.orders" ref="myMessageListener"/>
</jms:jca-listener-container>

The available configuration options for the JCA variant are described in the following table:

Table Attributes of the JMS <jca-listener-container/> element

Attributes of the JMS jca-listener-container elementAttributes of the JMS jca-listener-container element

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Java-Springs Topics