title: How to put the message got from jdbc to rabbitmq?
body: <p>In the <a href="http://docs.spring.io/spring-integration/reference/html/jdbc.html" rel="nofollow">spring integration reference on JDBC Support</a>
  it has the following code to get the records out of a table and convert them into message and sent them to a channel. But my system is rabbitmq so I want the message from jdbc stored in rabbitmq and consumed by rabbitmq client. How to do that using spring integration and spring rabbitmq?</p>
  
  <pre><code>&lt;int-jdbc:inbound-channel-adapter query="select * from item where status=2"
      channel="target" data-source="dataSource"
      update="update item set status=10 where id in (:id)" /&gt;
  </code></pre>
  
  <p>I know there are AMQP Backed Message Channels, and defined as below. </p>
  
  <pre><code>&lt;int-amqp:channel id="p2pChannel"/&gt;
  </code></pre>
  
  <p>But how to put them together? So that the message created from a table will be stored in a rabbitmq queue?</p>
  
  <p>update: I used the following code:</p>
  
  <pre><code>&lt;bean id="dataSource"  class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt;
      &lt;property name="driverClassName" value="org.postgresql.Driver"/&gt;
      &lt;property name="url" value="jdbc:postgresql://localhost/example"/&gt;
      &lt;property name="username" value="postgres"/&gt;
      &lt;property name="password" value="oracle"/&gt;
  &lt;/bean&gt;
  
  &lt;int-amqp:channel id="myMessageChannel_test"/&gt;
  
  
  &lt;int-jdbc:inbound-channel-adapter query="select * from my_files where message_created=0"
                                    channel="myMessageChannel_test" data-source="dataSource"
                                    update="update my_files set message_created=1 where file_id in (:file_id)"&gt;
      &lt;int:poller fixed-rate="1000"&gt;
          &lt;int:transactional/&gt;
      &lt;/int:poller&gt;
  &lt;/int-jdbc:inbound-channel-adapter&gt;
  </code></pre>
  
  <p>But it complains:</p>
  
  <pre><code>    at java.lang.Thread.run(Thread.java:745)
  Caused by: org.springframework.messaging.MessageDeliveryException: Dispatcher has no subscribers for amqp-channel 'myMessageChannel_test'.; nested exception is org.springframework.integration.MessageDispatchingException: Dispatcher has no subscribers
      at org.springframework.integration.amqp.channel.AbstractSubscribableAmqpChannel$DispatchingMessageListener.onMessage(AbstractSubscribableAmqpChannel.java:197)
      at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:737)
      ... 10 common frames omitted
  Caused by: org.springframework.integration.MessageDispatchingException: Dispatcher has no subscribers
      at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:107)
      at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:97)
      at org.springframework.integration.amqp.channel.AbstractSubscribableAmqpChannel$DispatchingMessageListener.onMessage(AbstractSubscribableAmqpChannel.java:181)
      ... 11 common frames omitted
  
  2014-12-30 19:23:18.985  WARN 29203 --- [cTaskExecutor-1] s.a.r.l.ConditionalRejectingErrorHandler : Execution of Rabbit message listener failed.
  
  org.springframework.amqp.rabbit.listener.exception.ListenerExecutionFailedException: Listener threw exception
      at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.wrapToListenerExecutionFailedExceptionIfNeeded(AbstractMessageListenerContainer.java:802)
      at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:740)
      at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:628)
      at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$001(SimpleMessageListenerContainer.java:82)
      at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$1.invokeListener(SimpleMessageListenerContainer.java:167)
      at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.invokeListener(SimpleMessageListenerContainer.java:1196)
      at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.executeListener(AbstractMessageListenerContainer.java:600)
      at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.doReceiveAndExecute(SimpleMessageListenerContainer.java:960)
      at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.receiveAndExecute(SimpleMessageListenerContainer.java:944)
      at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$700(SimpleMessageListenerContainer.java:82)
      at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1058)
  </code></pre>