5

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!

Justin Bertram
  • 29,372
  • 4
  • 21
  • 43
Adee J
  • 75
  • 1
  • 5
  • Isn't `tibcoEmsConnectionFactory` is about JMS as well? Doesn't `Jms.messageDrivenChannelAdapter()` work for you? – Artem Bilan Nov 08 '18 at 16:50
  • What is your XML on the matter BTW? – Artem Bilan Nov 08 '18 at 16:50
  • 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)'` I'm using spring-integration-core 5.0.7.RELEASE and spring-integration-java-dsl 1.2.2.RELEASE – Adee J Nov 08 '18 at 17:18
  • 1
    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 https://github.com/spring-projects/spring-integration-java-dsl/wiki/Spring-Integration-Java-DSL-Reference: `This project has been absorbed by Spring Integration Core starting with version 5.0.` – Artem Bilan Nov 08 '18 at 17:25

1 Answers1

4

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

Artem Bilan
  • 113,505
  • 11
  • 91
  • 118
  • Thanks @ArtemBilan, after removing the `spring-integration-java-dsl` artifact, I was able to configure to atleast connect to the Tibco EMS. I created a `DefaultMessageListenerContainer` with the `TibjmsConnectionFactory` and `TibjmsTopic` and passed it to `Jms.messageDrivenChannelAdapter`. But now after the application starts I keep getting this error message in the logs - `o.s.j.l.DefaultMessageListenerContainer : Setup of JMS message listener invoker failed for destination 'Topic[tibcoTopic]' - trying to recover. Cause: Not permitted`. – Adee J Nov 08 '18 at 22:33
  • 1
    The `Cause: Not permitted` is something specific to Tibco I guess and already out of Spring Integration scope. – Artem Bilan Nov 08 '18 at 22:35
  • Checked with my Tibco admin and found out they do not allow us to create durable subscribers, hence the "Not permitted" error. I'll have to use JNDI to make this work now. Thanks @ArtemBilan for your inputs. – Adee J Nov 09 '18 at 15:58