PDA

View Full Version : Conditionally enriching an item using multiple DAOs



ndefreitas
Mar 13th, 2008, 01:54 PM
In a use case where I need to conditionally call a second service based on the results of a first service (i.e. by inspecting attributes on the item populated using the first DAO) is it appropriate to use a delegating writer together with a CompositeItemTransformer (see multi-line sample job - uses simple transformer)? Essentially applying the filter chain pattern to the item.

Or is there another/better way to accomplish the same thing?

Also,
In the use case where there are three DAOs (where the 2nd and 3rd can be executed in parallel, but depend on results of the 1st), how do you parallelize the 2nd and 3rd DAOs?

Nigel

gk5885
Mar 13th, 2008, 03:48 PM
In a use case where I need to conditionally call a second service based on the results of a first service (i.e. by inspecting attributes on the item populated using the first DAO) is it appropriate to use a delegating writer together with a CompositeItemTransformer (see multi-line sample job - uses simple transformer)? Essentially applying the filter chain pattern to the item.

Or is there another/better way to accomplish the same thing?


it sounds like one transformer with an if statement would probably do it... 'filters' aren't usually conditional.



Also,
In the use case where there are three DAOs (where the 2nd and 3rd can be executed in parallel, but depend on results of the 1st), how do you parallelize the 2nd and 3rd DAOs?

Nigel

services or DAOs? services can be exposed with message exchange patterns that allow for parallelism, while DAOs are typically invoked synchronously. chances are that you'd probably be better off parallelizing chunk processing rather than DAO invocation just because there's a whole host of concurrency issues with that approach.

ndefreitas
Mar 14th, 2008, 06:56 AM
I'll take a look at the chunking example and services...