Pankaj Pawar
Pankaj Pawar

Reputation: 107

JMS configuration for Spring Integration

I am trying to implement activemq(just want to receive messages) with spring integration.I cant find any clues how to provide java configuration for activemq. What are the minimum required components for job. Somewhere we have channel, adapter somewhere we dont. I am unable to understand spring concepts of adapter, channel and service activator. They are all feeling same to me. I find the integration documentation going above my head. I never had problems with understanding other spring modules(boot, mvc, cloud, batch). Can someone point me in the right direction or what is it that I am doing wrong.

Upvotes: 0

Views: 192

Answers (1)

Artem Bilan
Artem Bilan

Reputation: 121552

You probably are missing the fact that Spring Integration is a reference implementation for well-known Enterprise Integration Patterns. So, please, consider to start from the theory and ideas. Then you can come back to Spring Integration as an API for those EIP. See respective book on the matter: https://www.enterpriseintegrationpatterns.com.

To read messages from JMS destination you need to use a JmsMessageDrivenEndpoint with respective ConnectionFactory injected.

There is nothing more about that than an ActiveMQConnectionFactory as a bean. For example in tests we do like this:

new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false")

And an in-memory broker is started.

See a test class with Java DSL for some way how to configure JMS components: https://github.com/spring-projects/spring-integration/blob/master/spring-integration-jms/src/test/java/org/springframework/integration/jms/dsl/JmsTests.java

Upvotes: 2

Related Questions