Search code examples
spring-integrationspring-dsl

Spring Integration DSL Channel Support


In the current release 1.0.2 of spring integration dsl I can see some of the basic channels are not present like ReST/HTTP, TCP/UDP, JDBC, MQTT, etc.

Just wanted to know whether this protocols/channel are in roadmap or it has been excluded deliberately.

PS: I might be sounding stupid with posted question but just wanted to know the reason.


Solution

  • From one side you should understand that it is enough big work to address them all. For example HTTP module is on our radar for the 1.1 release.

    From other side the Spring Integration Java DSL is just an edition to the existing Spring Java & Annotation configuration, so any @Bean definition is valid there, too.

    With those desired protocols you can go ahead and configure their components as @Bean and refer them from the .handle() or .from() EIP-methods.

    For example:

    @Bean
    public MessageSource<Object> jdbcMessageSource() {
        return new JdbcPollingChannelAdapter(this.dataSource, "SELECT * FROM foo");
    }
    
    @Bean
    public IntegrationFlow myFlow() {
       return IntegrationFlows.from(jdbcMessageSource())
                            .split(...)
                            .transform(...)
                            .handle(new MqttPahoMessageHandler("tcp://localhost:1883", "si-test-out"))
                            .get();
    }