Search code examples
springspring-integrationspring-integration-dsltibco-ems

Use Spring Integration DSL to read from Tibco EMS topic


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!


Solution

  • 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