5
votes

I've been trying to configure spring integration dsl to read from a Tibco EMS topic , do some processing on the received message and then push it to an ActiveMQ queue. I was able to set this up successfully using XML configuration, but wanted to use spring integration dsl instead. I couldn't figure out, neither could find any help online about it.

My configuration for pushing message to ActiveMQ is something like this -

@Bean
public IntegrationFlow toActiveMQFlow(
        MessageChannel channel,
        ActiveMQQueue queue,
        CachingConnectionFactory cachingConnectionFactory) {
    return IntegrationFlows.from(channel)
            .transform(Object::toString)
            .handle(Jms.outboundAdapter(cachingConnectionFactory).destination(queue))
            .get();
}

And I'm thinking that the configuration for reading from Tibco EMS topics should be something like this -

@Bean
public IntegrationFlow fromTibcoTopicFlow(
        MessageChannel channel,
        ConnectionFactory tibcoEmsConnectionFactory,
        Topic tibcoTopic
) {
    return IntegrationFlows
            .from(SomeInboundAdapter(tibcoEmsConnectionFactory).destination(tibcoTopic))
            .transform(Object::toString)
            .channel(channel)
            .get();
}

Since I did not find much help on the latter configuration, is resorting to the XML configuration my only option here?

Kindly correct/edit/point out any mistakes I've made, still learning Spring Integration DSL.

Appreciate your help!

1
Isn't tibcoEmsConnectionFactory is about JMS as well? Doesn't Jms.messageDrivenChannelAdapter() work for you?Artem Bilan
What is your XML on the matter BTW?Artem Bilan
I tried with Jms.inboudAdapter and Jms.messageDrivenChannelAdapter, but keep getting this compilation error - Cannot resolve method 'from(org.springframework.integration.dsl.jms.JmsMessageDrivenChannelAdapterSpec.JmsMessageDrivenChannelAdapterListenerContainerSpec<org.springframework.integration.dsl.jms.JmsDefaultListenerContainerSpec,org.springframework.jms.listener.DefaultMessageListenerContainer>)' I'm using spring-integration-core 5.0.7.RELEASE and spring-integration-java-dsl 1.2.2.RELEASEAdee J
Starting with version Spring Integration 5.0 you shouldn't use that extra artifact for Java DSL. It is now included into the core project. See github.com/spring-projects/spring-integration-java-dsl/wiki/…: This project has been absorbed by Spring Integration Core starting with version 5.0.Artem Bilan

1 Answers

4
votes

You need to use a Jms.messageDrivenChannelAdapter(ConnectionFactory connectionFactory).

And souldn't use a spring-integration-java-dsl. It was merged to the core project since version 5.0: https://docs.spring.io/spring-integration/docs/5.0.9.RELEASE/reference/html/whats-new.html#_java_dsl

We have fixed the issue with an old Java DSL jar on classpath: https://jira.spring.io/browse/INT-4551