Search code examples
spring-integration

Spring Integration Fetch SQL Data after the Flow starts


Have an integration flow which polls a JMS queue and for each message, using a field from the message data need to fire a SELECT query and then split the results from it for further processing.

How do I run a SELECT query in the mid of the flow using Java DSL? Tried with JdbcOutboundGateway and it is expecting the Poller object.

Thanks


Solution

  • The JdbcOutboundGateway is the correct way to solve your task. It does not require the poller. That's endpoint which is going to call this JdbcOutboundGateway expects the poller. Just because the input channel is a QueueChannel in your case. Not sure why would one need a queue just after a JMS queue...

    Spring Integration model is like this:

    channel -> endpoint (poller) -> message handler (-> channel)
    

    Whatever is in the parentheses ч is optional and depend on the channel and message handler implementation, respectively.