title: Retrieving data from database using spring integration JDBC without poll
body: <p>Currently learning spring integration, I want to retrieve information from a MySQL database to use inside an <code>int:service-activator</code>, or an <code>int:splitter</code> .</p>
  
  <p>Unfortunately, it would seem that most examples and documentation is based around the idea of using an <code>int-jdbc:inbound-channel-adapter</code>, which in itself requires a poller. I don't want to poll a database, but rather retrieve specific data based on the payload of an existing message originating from an <code>int:gateway</code>. This data would then be used to further modify the payload, or assist in how the message is split.</p>
  
  <p>I tried using <code>int-jdbc:outbound-gateway</code>, as the description states:</p>
  
  <blockquote>
    <p>... jdbc.JdbcOutboundGateway' for updating a database in response to a message on the request channel, and/or for retrieving data from the database ... </p>
  </blockquote>
  
  <p>This implies that it can be used for retrieval of data only and not just updates, but as I implement it, there's a complaint that at least one update statement is required:</p>
  
  <p><a href="https://i.stack.imgur.com/A6hfR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/A6hfR.png" alt="Update required for outbound-gateway"></a></p>
  
  <p>And so I'm currently sitting with a faulty prototype that initially looks like so:</p>
  
  <p><a href="https://i.stack.imgur.com/8necb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8necb.png" alt="Start of integration-context diagram"></a></p>
  
  <p>The circled piece being the non-functioning <code>int-jdbc:outbound-gateway</code>.</p>
  
  <p>My end goal is to, based on the payload coming from the <code>incomingGateway</code> (in the picture above), retrieve some information from a MySQL database, and use that data to split the message in the <code>analyzerSplitter</code>, or to perhaps modify the payload using an <code>int:service-activator</code>. This should then all be linked up to a <code>int-jdbc:message-store</code> which I believe could assist with performance. I do not wish to poll the database on a regular basis, and I do not wish to update anything in the database.</p>
  
  <p>By testing using the polling <code>int-jdbc:inbound-channel-adapter</code>, I am confident that my datasource bean is set up correctly and the query can execute.</p>
  
  <p>How would I go about correctly setting up such behaviour in spring integration?</p>