Search code examples
spring-integrationspring-jmsspring-integration-dsl

@Role in IntegrationFlow DSL


Is it possible to specify the endpoint role used for leadership election through the IntegrationFlow dsl when using a message driven channel adapter?

I can create a JMS message driven endpoint using the Jms dsl and set the role on the endpoint but I can't see a method to specify the role through the IntegrationFlow dsl.


Solution

  • The MessageProducerSpec, a super class of the JmsMessageDrivenChannelAdapterSpec is rally missing that property now.

    Will be fixed soon. The release is next week.

    Meanwhile you can do something like this:

    JmsMessageDrivenEndpoint jmsMessageDrivenEndpoint = 
                    Jms.messageDrivenChannelAdapter(amqFactory)
                            .destination("some_destination")
                            .getObject();
            jmsMessageDrivenEndpoint.setRole("some_role");
    
            return IntegrationFlow
                    .from(jmsMessageDrivenEndpoint)