Skip to content

Commit 4ade0ce

Browse files
artembilangaryrussell
authored andcommitted
INT-4385: Clarify <jms> namespace in jms.adoc
JIRA: https://jira.spring.io/browse/INT-4385 It is slightly unclear for end-users that `<jms:listener-container/>` is just a syntax sugar and the real JMS container is created by the `<jms:listener>` sub-element * Add a NOTE to the `jms.adoc` to explain such a confuse and what and how is going to happen if the intention to use a `<jms:listener-container/>` for Spring Integration channel adapters.
1 parent 7135d06 commit 4ade0ce

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

src/reference/asciidoc/jms.adoc

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,17 @@ If you have a custom listener container implementation (usually a subclass of `D
126126
In that case, the attributes on the adapter are transferred to an instance of your custom container.
127127
=====
128128

129+
[NOTE]
130+
=====
131+
You can't use the Spring JMS namespace element `<jms:listener-container/>` to configure a container reference for the `<int-jms:message-driven-channel-adapter>` since that element doesn't actually reference a container.
132+
Each `<jms:listener/>` sub-element gets its own `DefaultMessageListenerContainer` (with shared attributes defined on the parent `<jms:listener-container/>` element).
133+
You can give each listener sub-element an `id`, and use that to inject into the channel adapter, however, the `<jms:/>` namespace requires a real listener.
134+
Since, for Spring Integration, the adapter itself needs to configure the listener, the configured listener will be overwritten.
135+
If you go this route, you will see a warning for each adapter.
136+
137+
It is recommended to configure a regular `<bean>` for the `DefaultMessageListenerContainer` and use it as a reference in the channel adapter.
138+
=====
139+
129140
IMPORTANT: Starting with version 4.2, the default `acknowledge` mode is `transacted`, unless you provide an external
130141
container.
131142
In that case, you should configure the container as needed.
@@ -254,7 +265,7 @@ You can use the error-channel attribute to configure such a channel, as the foll
254265
[source,xml]
255266
----
256267
<int-jms:inbound-gateway request-destination="requestQueue"
257-
request-channel="jmsinputchannel"
268+
request-channel="jmsInputChannel"
258269
error-channel="errorTransformationChannel"/>
259270
260271
<int:transformer input-channel="exceptionTransformationChannel"
@@ -598,13 +609,11 @@ Note that, if the service is never expected to return a reply, it would be bette
598609
With the latter, the sending thread is blocked, waiting for a reply for the `receive-timeout` period.
599610
<25> When you use a `<reply-listener />`, its lifecycle (start and stop) matches that of the gateway by default.
600611
When this value is greater than `0`, the container is started on demand (when a request is sent).
601-
The container continues to run until at least this time elapses with no requests being received (and until no replies
602-
are outstanding).
612+
The container continues to run until at least this time elapses with no requests being received (and until no replies are outstanding).
603613
The container is started again on the next request.
604614
The stop time is a minimum and may actually be up to 1.5x this value.
605615
<26> See <<jms-async-gateway>>.
606-
<27> When this element is included, replies are received by an asynchronous `MessageListenerContainer` rather than
607-
creating a consumer for each reply.
616+
<27> When this element is included, replies are received by an asynchronous `MessageListenerContainer` rather than creating a consumer for each reply.
608617
This can be more efficient in many cases.
609618
====
610619

0 commit comments

Comments
 (0)