Results 1 to 4 of 4

Thread: Jdbc Inbound Adapter questions

  1. #1
    Join Date
    Mar 2011
    Posts
    22

    Default 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:

    jdbc:inbound-channel-adapter
    |
    |
    V
    splitter (output channel is a queue channel)
    |
    |
    V
    service-activator (configured with a poller to begin the transaction boundary)
    |
    |
    V
    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. #2
    Join Date
    Jan 2009
    Location
    Ukraine, Kharkov
    Posts
    635

    Default

    Hello

    Everything souds OK.
    However these are answers for your questions:
    1.
    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. #3
    Join Date
    Mar 2011
    Posts
    22

    Default

    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. #4
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,840

    Default

    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.
    -Mark

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •