@@ -24,17 +24,16 @@ usual (Spring) POJOs. Currently, Spring supports the following remoting technolo
24
24
25
25
* *Remote Method Invocation (RMI)*: Through the use of `RmiProxyFactoryBean` and
26
26
`RmiServiceExporter`, Spring supports both traditional RMI (with `java.rmi.Remote`
27
- interfaces and `java.rmi.RemoteException`) and transparent remoting through RMI invokers
28
- (with any Java interface).
27
+ interfaces and `java.rmi.RemoteException`) and transparent remoting through RMI
28
+ invokers (with any Java interface).
29
29
* *Spring's HTTP invoker*: Spring provides a special remoting strategy that allows
30
30
for Java serialization though HTTP, supporting any Java interface (as the RMI
31
- invoker does). The corresponding support classes are `HttpInvokerProxyFactoryBean` and
32
- `HttpInvokerServiceExporter`.
31
+ invoker does). The corresponding support classes are `HttpInvokerProxyFactoryBean`
32
+ and `HttpInvokerServiceExporter`.
33
33
* *Hessian*: By using Spring's `HessianProxyFactoryBean` and the
34
34
`HessianServiceExporter`, you can transparently expose your services through the
35
35
lightweight binary HTTP-based protocol provided by Caucho.
36
- * *JAX-WS*: Spring provides remoting support for web services through JAX-WS (the
37
- successor of JAX-RPC, as introduced in Java EE 5 and Java 6).
36
+ * *JAX-WS*: Spring provides remoting support for web services through JAX-WS.
38
37
* *JMS*: Remoting by using JMS as the underlying protocol is supported through the
39
38
`JmsInvokerServiceExporter` and `JmsInvokerProxyFactoryBean` classes.
40
39
* *AMQP*: Remoting by using AMQP as the underlying protocol is supported by the Spring
@@ -627,7 +626,6 @@ and Spring's `@Autowired` configuration annotation is still honored):
627
626
public List<Account> getAccounts(String name) {
628
627
return biz.getAccounts(name);
629
628
}
630
-
631
629
}
632
630
----
633
631
====
@@ -732,8 +730,8 @@ accordingly first. Check the JAX-WS documentation for details on those requireme
732
730
[[remoting-jms]]
733
731
=== Exposing Services through JMS
734
732
735
- You can also expose services transparently by using JMS as the underlying
736
- communication protocol. The JMS remoting support in the Spring Framework is pretty basic.
733
+ You can also expose services transparently by using JMS as the underlying communication
734
+ protocol. The JMS remoting support in the Spring Framework is pretty basic.
737
735
It sends and receives on the `same thread` and in the same non-transactional
738
736
`Session`. As a result, throughput is implementation-dependent. Note that these
739
737
single-threaded and non-transactional constraints apply only to Spring's JMS
@@ -751,7 +749,6 @@ The following interface is used on both the server and the client sides:
751
749
public interface CheckingAccountService {
752
750
753
751
public void cancelAccount(Long accountId);
754
-
755
752
}
756
753
----
757
754
====
@@ -769,13 +766,12 @@ The following simple implementation of the preceding interface is used on the se
769
766
public void cancelAccount(Long accountId) {
770
767
System.out.println("Cancelling account [" + accountId + "]");
771
768
}
772
-
773
769
}
774
770
----
775
771
====
776
772
777
- The following configuration file contains the JMS-infrastructure beans that are shared on both
778
- the client and server:
773
+ The following configuration file contains the JMS-infrastructure beans that are shared
774
+ on both the client and the server:
779
775
780
776
====
781
777
[source,xml,indent=0]
@@ -846,7 +842,6 @@ On the server, you need to expose the service object that uses the
846
842
public static void main(String[] args) throws Exception {
847
843
new ClassPathXmlApplicationContext(new String[]{"com/foo/server.xml", "com/foo/jms.xml"});
848
844
}
849
-
850
845
}
851
846
----
852
847
====
@@ -897,7 +892,6 @@ proxy takes care of forwarding the call to the server-side object via JMS):
897
892
CheckingAccountService service = (CheckingAccountService) ctx.getBean("checkingAccountService");
898
893
service.cancelAccount(new Long(10));
899
894
}
900
-
901
895
}
902
896
----
903
897
====
@@ -916,8 +910,8 @@ Auto-detection is not implemented for remote interfaces
916
910
917
911
The main reason why auto-detection of implemented interfaces does not occur for remote
918
912
interfaces is to avoid opening too many doors to remote callers. The target object might
919
- implement internal callback interfaces, such as `InitializingBean` or `DisposableBean`, which
920
- one would not want to expose to callers.
913
+ implement internal callback interfaces, such as `InitializingBean` or `DisposableBean`
914
+ which one would not want to expose to callers.
921
915
922
916
Offering a proxy with all interfaces implemented by the target usually does not matter
923
917
in the local case. However, when you export a remote service, you should expose a specific
@@ -936,13 +930,13 @@ effort and puts you on the safe side regarding controlled exposure of specific m
936
930
[[remoting-considerations]]
937
931
=== Considerations when Choosing a Technology
938
932
939
- Each and every technology presented here has its drawbacks. When choosing a technology, you should carefully
940
- consider your needs, the services you expose, and the objects you send
941
- over the wire.
933
+ Each and every technology presented here has its drawbacks. When choosing a technology,
934
+ you should carefully consider your needs, the services you expose, and the objects you
935
+ send over the wire.
942
936
943
937
When using RMI, you cannot access the objects through the HTTP protocol,
944
- unless you tunnel the RMI traffic. RMI is a fairly heavy-weight protocol, in that
945
- it supports full-object serialization, which is important when you use a complex data model
938
+ unless you tunnel the RMI traffic. RMI is a fairly heavy-weight protocol, in that it
939
+ supports full-object serialization, which is important when you use a complex data model
946
940
that needs serialization over the wire. However, RMI-JRMP is tied to Java clients. It is
947
941
a Java-to-Java remoting solution.
948
942
@@ -967,8 +961,8 @@ technologies.
967
961
Last but not least, EJB has an advantage over RMI, in that it supports standard
968
962
role-based authentication and authorization and remote transaction propagation. It is
969
963
possible to get RMI invokers or HTTP invokers to support security context propagation as
970
- well, although this is not provided by core Spring. Spring offers only appropriate hooks for
971
- plugging in third-party or custom solutions.
964
+ well, although this is not provided by core Spring. Spring offers only appropriate hooks
965
+ for plugging in third-party or custom solutions.
972
966
973
967
974
968
@@ -1608,6 +1602,19 @@ implementation of Spring's `PlatformTransactionManager` for JMS (the cunningly n
1608
1602
`JmsTransactionManager`). This allows for seamless integration of JMS as a transactional
1609
1603
resource into Spring's transaction management mechanisms.
1610
1604
1605
+ [NOTE]
1606
+ ====
1607
+ As of Spring Framework 5, Spring's JMS package fully supports JMS 2.0 and requires the
1608
+ JMS 2.0 API to be present at runtime. We recommend the use of a JMS 2.0 compatible provider.
1609
+
1610
+ If you happen to use an older message broker in your system, you may try upgrading to a
1611
+ JMS 2.0 compatible driver for your existing broker generation. Alternatively, you may also
1612
+ try to run against a JMS 1.1 based driver, simply putting the JMS 2.0 API jar on the
1613
+ classpath but only using JMS 1.1 compatible API against your driver. Spring's JMS support
1614
+ adheres to JMS 1.1 conventions by default, so with corresponding configuration it does
1615
+ support such a scenario. However, please consider this for transition scenarios only.
1616
+ ====
1617
+
1611
1618
1612
1619
1613
1620
[[jms-using]]
0 commit comments