jmslistenerspring-integrationspring-dsl

Convert @JmsListener code to String Integration DSL


@JmsListener(destination = "myListener")
    public void receive(Event even) {

            if (event.myObj().isComp()) {
                service1.m1(even);
            }
            if (event.myObj2().isdone()) {
                service2.m2(event);
            }
    }

I tried various combinations, and one of them is below

@Bean
    public IntegrationFlow flow1() {
        return IntegrationFlows
                .from(Jms.messageDrivenChannelAdapter(connectionFactory).destination("incomingQueue"))
                .<Event>filter(e -> ((Event)e).myObj().isComp()).handle(service1, "m1")
                .<Event>filter(e -> ((Event)e).myObj2().isdone()).handle(service2, "m2")//looks like its not called
                .get();
    }

But it does not executes on 2nd filter/condition. Please suggest what I am missing here


Solution

  • It worked, after I put @ServiceActivator annotation on m1 as well as m2. My bad, I missed this annotation while converting code to SI