Search code examples
spring-jmsspring-messaging

What is the difference between Spring JMS and Spring Messaging?


There are two libraries: spring-messaging and spring-jms. They both have got similar classes: MarshallingMessageConverter, MarshallingMessageConverter, etc.

Why do we need these similar libraries?


Solution

  • The are not similar. The spring-messaging is a set of messaging components which are used in target implementation. The JMS is one of them. Another one is WebSocket. More about messaging is in Spring Integration: https://spring.io/projects/spring-integration. It's just coincident that those classes are named similar. However they are in different packages and serve the same purpose - deal with an XML payload. Although the last one is really specific to only JMS. You may find similar name for classes specific to AMQP protocol in Spring AMQP project: https://spring.io/projects/spring-amqp which is also based on the mentioned spring-messaging API. And there are more like Spring for Apache Kafka: https://spring.io/projects/spring-kafka. Spring Cloud Stream also uses some of that messaging API: https://spring.io/projects/spring-cloud-stream. So, Spring JMS is just one of the samples where Spring Messaging concepts are applied.