haju
haju

Reputation: 1298

Converting message-driven-channel-adapter xml to annotation

I'm trying to convert my working spring integration xml configuration to annotation and I was wondering what annotation should be used for message-driven channels or if there was any? Would it be the @JMSListener?

<jms:message-driven-channel-adapter id="jmsIn"
        channel="jmsInChannel"
        destination="request"
        error-channel="errorChannel"/>

Upvotes: 2

Views: 3594

Answers (1)

Artem Bilan
Artem Bilan

Reputation: 121542

No, you don't need to worry about any annotations there.

The class for <jms:message-driven-channel-adapter> is JmsMessageDrivenEndpoint and since it is message-driven it is a thing itself.

So, you should just declare it as a @Bean, as well as its dependencies.

From other side that may end up a bit complicated if your are going to provide enough customization with AbstractMessageListenerContainer and ChannelPublishingJmsMessageListener dependencies.

Consider to use Spring Integration Java DSL which has been introduced exactly for similar confusing cases: to simplify the way how XML config moves to Java & Annotations config.

You can find there the tests for JMS adapters: https://github.com/spring-projects/spring-integration-java-dsl/blob/master/src/test/java/org/springframework/integration/dsl/test/jms/JmsTests.java

Upvotes: 1

Related Questions