Search code examples
spring-integrationspring-dsl

MessageSource as a flow step


I'm writing a SI flow using the SI-DSL, so let me start by saying I don;t know if this question is related to the Si-DSL only or to both SI and SI-DSL.

My use case is like this
- getting messages from a Queue - saving the messages in a database table - retrieve those messages by selecting messages at some specific state at some point in the future - further processing the messages...

My problem is the 3rd step. It will be easy if the 3rd step was the 1st, because I could just use a JdbcPollingChannelAdapteras a MessageSource. However, I could not find a way of using one in the middle of the flow. So, in DSL terms, I can do (where dbDataMessageSource is a JdbcPollingChannelAdapter)

IntegrationFlows
    .from(dbDataMessageSource(), p -> p.poller(Pollers.fixedRate(24, TimeUnit.HOURS)))

But I cannot do

IntegrationFlows
            .from(Jms.messageDrivenChannelAdapter(...))
            .handle(new JdbcOutboundGateway(...)
            .handle(dbDataMessageSource(), p -> p.poller(Pollers.fixedRate(24, TimeUnit.HOURS)))

Instead of ".handle" I tried to use gateway, bridge, handleWithAdapter, but noting worked.

Any ideas?

Cheers.


Solution

  • Well, I found a way to do this the way I mentioned. I can rewrite the JdbcOutboundGateway, that includes both a JdbcMessageHandler and a JdbcPollingChannelAdapter, and make this last one configurable so I can set the polling time and the output channel the way I want it.

    A little dodgy but it should work.

    Cheers.