Announcement Announcement Module
No announcement yet.
Jdbc Inbound Adapter questions Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Jdbc Inbound Adapter questions

    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:

    splitter (output channel is a queue channel)
    service-activator (configured with a poller to begin the transaction boundary)
    null-channel (commits the transaction)

    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?

  • #2

    Everything souds OK.
    However these are answers for your questions:
    to have a message per row on a select
    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


    • #3
      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.


      • #4
        We were actually just having a discussion about that (the generic feature in fact - for any adapter that may handle multiple or single item payloads).

        For now, the simplest thing you can do is add a <splitter> immediately after the adapter.

        Hope that helps.