Fairly new to Spring Integration and I've read documentation and several threads on using Spring Integration and polling a database (and then doing something afterwards).
What I would like to do is to poll a "queue table" in a database in a multi-threaded manner such that as more items exist in the queue table more polling threads are created to go after the new work. So, this seems to be handled with a Poller from Spring Integration and a Task Executor from the Spring framework. Here's the struggle though... when I do something like this with 100 items in my queue table:
it works as I would want it to, where work is being pulled from the queue table and being handled by several different threads at once. The downside to this, however, is that once I exhaust all the rows in the queue table, I don't really want it pounding away at my database every 100 milliseconds looking for more work to do. What I'd really rather do is something like this:Code:<integration:poller id="somePoller" task-executor="someExecutor" max-messages-per-poll="1"> <integration:interval-trigger interval="100" time-unit="MILLISECONDS" /> </integration:poller> <task:executor id="someExecutor" pool-size="5-100" queue-capacity="5"/>
but this doesn't work for me either because it polls once, finds an item, waits 5 seconds, polls again, and so on and so forth. What I really want it to do is to spin up a pool of threads when it has lots of work to do and then go back to sleeping and polling on 5 second intervals. Is there a simple mechanism for doing this?Code:<integration:poller id="somePoller" task-executor="someExecutor" max-messages-per-poll="1"> <integration:interval-trigger interval="5" time-unit="SECONDS" /> </integration:poller> <task:executor id="someExecutor" pool-size="5-100" queue-capacity="5"/>


Reply With Quote
But someone/something has to check (in database) whether there is some work to do...