I am new to the Spring integration. Previously I developed an application using Weblogic Integration where I poll a database table for any new rows. If there is one, I obtain that data, modify it and send it to a different database. I have seen several examples on Spring integration where it integrates web pages, emails etc. I want to set up a poll for a table and get the message to the gateway from where I can handle it. Any help or advice is appreciated.
2 Answers
This example is the basic Db poller..
<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)" />
For channel 'target', you can put your service-activator to handle message.. You may also need a row-mapper..
Tell me more about your problem if you need more advice.,
1 Comment
Jitendra Vispute
does poller work on single thread .eg. if it found some data and handed over the data to channel , if data is still processed will poller find new data and send data to same channel ?
See the inbound-channel-adapter in the reference documentation and/or the jdbc sample.
The sample doesn't show the use of the adapter, but it might help you with a general understanding of Spring Integration. Another useful resource is the test cases... integration tests and polling* parser tests.
3 Comments
AFW
Thanks for your help. Here is a brief description of my scenario. I need set up a listener to a table for any new inserts. As soon as there is one, I need to get that data, modify it and send it to another database table. Is that possible?
Gary Russell
Yes; but the accuracy of "as soon" will depend on the frequency of the poller - DBAs generally don't like you polling their DBs at high frequency.
AFW
Got it. Will try to configure 10 seconds.