By default, generic consumers and SOAP consumers do not wrap message exchanges in transactions. If there is a failure during the exchange, you have no guarantee that resending the request will not result in duplicating a task that has already been completed.
If your application requires message exchanges to be wrapped in a transaction, you can use the endpoint's transacted
attribute to specify the type of transactions to use. Table 3.3 describes the possible values for the transacted
attribute.
Table 3.3. Consumer Transaction Support
Value | Description |
---|---|
none | Specifies that message exchanges are not wrapped in a transaction. This is the default setting. |
jms | Specifies that message exchanges are wrapped in local JMS transactions. |
xa | Specifies that message exchanges will be wrapped in an externally managed XA transaction. You must also provide a transaction manager when using XA transactions. |
![]() | Important |
---|---|
Only the default listener container can support XA transactions. |
If you want to configure your consumer to use a JMS message selector, you can set the optional messageSelector
attribute. The value of the attribute is the string value of the selector. For more information on the syntax used to specify message selectors, see the JMS 1.1 specification.
If you want to configure your server to use durable subscriptions, you need to set values for two attributes. To indicate that the consumer uses a durable subscription you set the subscriptionDurable
attribute to true
. You specify the name used to register the durable subscription using the durableSubscriberName
attribute.
Example 3.7 shows a configuration snipit for a consumer that registers for a durable subscription.
Example 3.7. Consumer using a Durable Subscription
<beans xmlns:jms="http://servicemix.apache.org/jms/1.0"
... >
...
<jms:soap-consumer wsdl="classpath:widgets.wsdl"
destinationName="widgetQueue"
connectionFactory="#connectionFactory"
subscriptionDurable="true"
durableSubscriberName="widgetSubscriber" />
...
</beans>