Skip to content

Commit 6505cb9

Browse files
committed
Explicit documentation notes on JMS 2.0 vs 1.1 compatibility
Issue: SPR-17583 (cherry picked from commit 7b9c30f)
1 parent a9b453d commit 6505cb9

File tree

6 files changed

+42
-5
lines changed

6 files changed

+42
-5
lines changed

spring-jms/src/main/java/org/springframework/jms/connection/CachingConnectionFactory.java

+5
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@
6363
* lead to queue/topic mode, respectively; generic {@code createConnection}
6464
* calls will lead to a JMS 1.1 connection which is able to serve both modes.
6565
*
66+
* <p>As of Spring Framework 5, this class supports JMS 2.0 {@code JMSContext}
67+
* calls and therefore requires the JMS 2.0 API to be present at runtime.
68+
* It may nevertheless run against a JMS 1.1 driver (bound to the JMS 2.0 API)
69+
* as long as no actual JMS 2.0 calls are triggered by the application's setup.
70+
*
6671
* <p><b>NOTE: This ConnectionFactory requires explicit closing of all Sessions
6772
* obtained from its shared Connection.</b> This is the usual recommendation for
6873
* native JMS access code anyway. However, with this ConnectionFactory, its use

spring-jms/src/main/java/org/springframework/jms/connection/DelegatingConnectionFactory.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -36,6 +36,11 @@
3636
* if necessary (e.g. when running JMS 1.0.2 API based code against a generic
3737
* JMS 1.1 ConnectionFactory, such as ActiveMQ's PooledConnectionFactory).
3838
*
39+
* <p>As of Spring Framework 5, this class supports JMS 2.0 {@code JMSContext}
40+
* calls and therefore requires the JMS 2.0 API to be present at runtime.
41+
* It may nevertheless run against a JMS 1.1 driver (bound to the JMS 2.0 API)
42+
* as long as no actual JMS 2.0 calls are triggered by the application's setup.
43+
*
3944
* <p>This class allows for being subclassed, with subclasses overriding only
4045
* those methods (such as {@link #createConnection()}) that should not simply
4146
* delegate to the target ConnectionFactory.

spring-jms/src/main/java/org/springframework/jms/connection/SingleConnectionFactory.java

+5
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@
6161
* lead to queue/topic mode, respectively; generic {@code createConnection}
6262
* calls will lead to a JMS 1.1 connection which is able to serve both modes.
6363
*
64+
* <p>As of Spring Framework 5, this class supports JMS 2.0 {@code JMSContext}
65+
* calls and therefore requires the JMS 2.0 API to be present at runtime.
66+
* It may nevertheless run against a JMS 1.1 driver (bound to the JMS 2.0 API)
67+
* as long as no actual JMS 2.0 calls are triggered by the application's setup.
68+
*
6469
* <p>Useful for testing and standalone environments in order to keep using the
6570
* same Connection for multiple {@link org.springframework.jms.core.JmsTemplate}
6671
* calls, without having a pooling ConnectionFactory underneath. This may span

spring-jms/src/main/java/org/springframework/jms/connection/TransactionAwareConnectionFactoryProxy.java

+5
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@
7272
* (e.g. to perform manual transaction control). For typical application purposes,
7373
* simply use the standard JMS Session interface.
7474
*
75+
* <p>As of Spring Framework 5, this class delegates JMS 2.0 {@code JMSContext}
76+
* calls and therefore requires the JMS 2.0 API to be present at runtime.
77+
* It may nevertheless run against a JMS 1.1 driver (bound to the JMS 2.0 API)
78+
* as long as no actual JMS 2.0 calls are triggered by the application's setup.
79+
*
7580
* @author Juergen Hoeller
7681
* @since 2.0
7782
* @see UserCredentialsConnectionFactoryAdapter

spring-jms/src/main/java/org/springframework/jms/connection/UserCredentialsConnectionFactoryAdapter.java

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -63,6 +63,11 @@
6363
* definition just for the <i>option</i> of implicitly passing in user credentials
6464
* if the particular target ConnectionFactory requires it.
6565
*
66+
* <p>As of Spring Framework 5, this class delegates JMS 2.0 {@code JMSContext}
67+
* calls and therefore requires the JMS 2.0 API to be present at runtime.
68+
* It may nevertheless run against a JMS 1.1 driver (bound to the JMS 2.0 API)
69+
* as long as no actual JMS 2.0 calls are triggered by the application's setup.
70+
*
6671
* @author Juergen Hoeller
6772
* @since 1.2
6873
* @see #createConnection
@@ -320,7 +325,7 @@ private ConnectionFactory obtainTargetConnectionFactory() {
320325
/**
321326
* Inner class used as ThreadLocal value.
322327
*/
323-
private static class JmsUserCredentials {
328+
private static final class JmsUserCredentials {
324329

325330
public final String username;
326331

src/docs/asciidoc/integration.adoc

+14-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ usual (Spring) POJOs. Currently, Spring supports the following remoting technolo
3838
* __Hessian__. By using Spring's `HessianProxyFactoryBean` and the
3939
`HessianServiceExporter` you can transparently expose your services using the
4040
lightweight binary HTTP-based protocol provided by Caucho.
41-
* __JAX-WS__. Spring provides remoting support for web services via JAX-WS (the
42-
successor of JAX-RPC, as introduced in Java EE 5 and Java 6).
41+
* __JAX-WS__. Spring provides remoting support for web services via JAX-WS.
4342
* __JMS__. Remoting using JMS as the underlying protocol is supported via the
4443
`JmsInvokerServiceExporter` and `JmsInvokerProxyFactoryBean` classes.
4544
* __AMQP__. Remoting using AMQP as the underlying protocol is supported by the Spring
@@ -1568,6 +1567,19 @@ implementation of Spring's `PlatformTransactionManager` for JMS (the cunningly n
15681567
`JmsTransactionManager`). This allows for seamless integration of JMS as a transactional
15691568
resource into Spring's transaction management mechanisms.
15701569

1570+
[NOTE]
1571+
====
1572+
As of Spring Framework 5, Spring's JMS package fully supports JMS 2.0 and requires the
1573+
JMS 2.0 API to be present at runtime. We recommend the use of a JMS 2.0 compatible provider.
1574+
1575+
If you happen to use an older message broker in your system, you may try upgrading to a
1576+
JMS 2.0 compatible driver for your existing broker generation. Alternatively, you may also
1577+
try to run against a JMS 1.1 based driver, simply putting the JMS 2.0 API jar on the
1578+
classpath but only using JMS 1.1 compatible API against your driver. Spring's JMS support
1579+
adheres to JMS 1.1 conventions by default, so with corresponding configuration it does
1580+
support such a scenario. However, please consider this for transition scenarios only.
1581+
====
1582+
15711583

15721584

15731585
[[jms-using]]

0 commit comments

Comments
 (0)