JMS outbound Java adapter configuration

Is it possible to configure the JMS outbound adapter

<int-jms:outbound-channel-adapter id="jmsOut" destination="outQueue" channel="exampleChannel"/>

      

in a similar "simple" way, but using only java-based (annotations) configuration? If not, what is the easiest way to reach this point?

+3


source to share


1 answer


Eugene, I've already pointed you to Spring Java DSL Integration . This is the best way to simplify Spring integration with Java based configuration.

Since this is not the first question like this, please take a look at this project, which has a simple merge to Core SI:

@Bean
public IntegrationFlow jmsOutboundFlow() {
    return IntegrationFlows.from("exampleChannel")
                .handleWithAdapter(h ->
                    h.jms(this.jmsConnectionFactory).destination("outQueue"))
                .get();
}

      



Otherwise it might look like this for the original Java configuration and Annotation:

@Bean
@serviceActivator(inputChannel = "exampleChannel")
public MessageHandler jsmOutboundAdapter() {
   JmsTemplate template = new DynamicJmsTemplate();
   template.setConnectionFactory(this.jmsConnectionFactory);
   JmsSendingMessageHandler handler = new JmsSendingMessageHandler(template);
   handler.setDestinationName("outQueue");
   return handler;
}

      

+1


source







All Articles