This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

Jdbc Inbound Adapter questions

May 11th, 2012, 09:20 AM

I have a scenario that I've come across a few time. I'm using a jdbc:inbound-channel-adapter to retrieve say 100 rows from a table. I need to process each row with its own transaction. To accomplish this I have the follow setup:

Is this the correct approach? Is the QueueChannel the best choice for the Pollable Channel? Is there a way to configure the JDBC Inbound Adapter to have a message per row on a select that returns more than one row (in the past I've restricted the select to only return one row, but these were for low volume processes). What should I consider regarding the timing of the two pollers (jdbc inbound adapters, and service-activator)? The approach above seems to working, but is it the best approach?

JDBC-Splitter? And again I hear about this solution... There is no any component for you. Of course you can implement it on your own. But it won't be EIP by his architecture and it won't be so easy to write flexible solution.
2. You are doing good approach. You can read 100 rows per poll and UPDATE them as readed in the jdbc:inbound-channel-adapte
3. If you need process your records in parallel change your queue channel to executor channel. But you hae to wrap your service-activator to transaction yourself. Poller works only on queue channels
4. Do you realy need here service-activator? Maybe it will be enough to put here <outbound-channel-adapter> instead?

Hope, I'm clear.

Good luck,
Artem Bilan

Comment

Has there been any consideration to allowing the jdbc-inbound adapter to be configured to process each row as a separate message? Wouldn't that be similar to how the file-inbound adapter handles each file as a separate message?

I'm revisiting this issue due to a intermittent hibernate error I've been seeing. The error is a "illegally attempted to associate a proxy with two open Sessions" and seems to be related to the fact that I have two threads. One thread for the jdbc-inbound-adapter and one thread that reads from the queue channel.