Jul 29th, 2010, 05:27 PM
JDBC Gateway - Thoughts
The introduction of the inbound and outbound jdbc adapters to Spring Integration 2.0 are a great addition. As i was working with these adapters, i began to feel like there should be a jdbc gateway adapter (bi-directional). I can think of a many scenarious where we would want to include jdbc access in the middle of a unidirectional flow.
The use case is:
1. Inbound JMS adapter -> Payload contains keys (sent to "key" channel)
2. jdbc-gateway wired to inbound channel ("key" channel), retrieves object payload using key and outputs the full message on an output channel
3. outbound jdbc adapter writes to target database
Note: i can always use a service activator to accomplish the same functionality but it would be much simpler to have a full pallet of jdbc adapter functionality.
I could be missing something basic, so i'd would appreciate any feedback/thoughts.
Jul 30th, 2010, 03:04 AM
I think what you describe is what Hohpe calls Claim Check. Am I right?
Jul 30th, 2010, 09:47 AM
it is exatcly that behavior. but i always saw the idiom for the claim check pattern to be a more formal "ticketing" strategy provided by the integration layer. For example, in the claim check you would typically pass a message to some component and would persist the message and hand you back a formal claim ticket.
In my case, i would want to enrich the "key" message by obtaining the full payload before using the claim check to store the message and get a formal claim ticket.
I was using the service activator as a way to make a database call in the middle of a process flow.
Let me know if that makes sense.
Aug 2nd, 2010, 06:46 AM
To simplify the discussion, should there be a jdbc adapter (gateway) that can be used mid stream (not at the begining or end of a process) in a process flow?
Aug 3rd, 2010, 02:29 AM
I guess it's aguable whether this should be called a "gateway" or just a "service activator" where the service happens to be in a generic form (SQL query). In either case I can see how the framework could add value here - making something completely declarative where otherwise it would have required some (trivial) JDBC coding. We could combine the code from jdbc-inbound- and -outbound- adapters to implement this quite easily. If it is a framework feature, my vote would be for "jdbc-outbound-gateway".
Another use case is to do an insert from the data in the input channel (as per the existing outbound adapter), and respond with the result of a select in the output channel (e.g. picking up a generated primary key).
Aug 3rd, 2010, 07:36 AM
Thanks for the reponse. I created a JIRA ticket for this enhancement: https://jira.springsource.org/browse/INT-1327
Last edited by dussab; Aug 3rd, 2010 at 07:47 AM.
Tags for this Thread