camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: If condition is met then we can continue the process ?
Date Mon, 25 May 2009 12:37:24 GMT
On Mon, May 25, 2009 at 1:34 PM, Charles Moulliard <cmoulliard@gmail.com> wrote:
> Can I put a "content message router" between the split() and the end() ?
Yeah you should be able to nest as your like. So give it a try.
If it gets to complex in one route, you can split it into smaller sub
routes and link using "direct" endpoint.


>
> e.g.
>
> *from("queue:in")* --> contain list of Order POJOs. Each list represents an
> unit (coming from a file) and must be processed as such
> ...
> *transacted()* --> order saving in the DB and list of POJOs to be put in the
> queues must be part of the same TX
> *split((body(), new MyOrderStrategy())* --> here we split the list of POJOs.
> Each POJO must be processed separately and the OrderStrategy aggregator will
> check for each POJO if the status is valid. If this is the case, then the
> exchange returned will contain the list of POJOS (rebuilded) + header
> property containing global status info "Orders accepted/Orders rejected")
> *.choice()
>   .when(POJO = "ABC")
>       .try()
>         .to(bean:validateABC)
>         .to(bean:transformABC)
>        .catch()
>        .to(bean:saveResult)
>   .when**(POJO = "XYZ")
> **       .try()*
> *         .to(bean:validateXYZ)
>         .to(bean:transformXYZ)
>        .catch()
>        .to(bean:saveResult)*
>
> *.end()*
> *.choice()
>
> .when(header("GlobalStatus").isEqualTo("Accepted")).to("queue:in:accepted")
>            .when(header("GlobalStatus").isEqualTo("Rejected")).to("queue:reporting")*
>
>
>
>
> Charles Moulliard
> Senior Enterprise Architect
> Apache Camel Committer
>
> *****************************
> blog : http://cmoulliard.blogspot.com
>
>
> On Tue, May 19, 2009 at 11:21 AM, Charles Moulliard <cmoulliard@gmail.com>wrote:
>
>> Very interesting the example of split  + request/reply
>>
>> Questions about this example :
>> 1) Are the messages processed in the same thread using the split +
>> aggregator + request/reply ?
>> 2) Can we // the threads for this split (this could be required due to
>> performance issues, ...) ?
>> 3) Can we add transacted() ?
>>
>> I plan to do this :
>>
>> *from("queue:in")* --> contain list of Order POJOs. Each list represents
>> an unit (coming from a file) and must be processed as such
>> ...
>> *transacted()* --> order saving in the DB and list of POJOs to be put in
>> the queues must be part of the same TX
>> *split((body(), new MyOrderStrategy())* --> here we split the list of
>> POJOs. Each POJO must be processed separately and the OrderStrategy
>> aggregator will check for each POJO if the status is valid. If this is the
>> case, then the exchange returned will contain the list of POJOS (rebuilded)
>> + header property containing global status info "Orders accepted/Orders
>> rejected")
>> *.to(bean:SaveOrder)*
>>
>> *.end()*
>> *.choice()
>>
>> .when(header("GlobalStatus").isEqualTo("Accepted")).to("queue:in:accepted")
>>             .when(header("GlobalStatus").isEqualTo("Rejected")).to("queue:reporting")*
>>
>>
>> Is it right ?
>>
>>
>> Charles Moulliard
>> Senior Enterprise Architect
>> Apache Camel Committer
>>
>> *****************************
>> blog : http://cmoulliard.blogspot.com
>>
>>
>> On Tue, May 19, 2009 at 10:35 AM, Claus Ibsen <claus.ibsen@gmail.com>wrote:
>>
>>> On Tue, May 19, 2009 at 10:11 AM, Charles Moulliard
>>> <cmoulliard@gmail.com> wrote:
>>> > Hi,
>>> >
>>> > I'm faced to the following problem that I want to solve without creating
>>> > something too much complex :
>>> >
>>> > A collection of orders contained in a message is first splitted. Each
>>> > individual order based on its type is routed and processed separately.
>>> The
>>> > next step consists in to check if all the orders (coming from my
>>> collection
>>> > A) have been processed. If this is the case and if they have their
>>> status
>>> > equal to "Validated", then we can place the orders in a queue.
>>> >
>>> > I have checked the aggregator but it will recreate a new message
>>> containing
>>> > all the orders and I don't want to do that.
>>> >
>>> > Is it possible to do what I describe in one transactional route ?
>>>
>>> The splitter has build in aggregator that aggregates all the messages
>>> it splits.
>>>
>>> Roughly like
>>>
>>> from -> transacted -> split (aggregator strategy) -> whatever route
>>> each splitted message should do -> end (important to mark end of split
>>> route )
>>> -> to (*)
>>>
>>> Ad *)
>>> He we continue *AFTER* the split that have aggregated all the split
>>> responses into a single message. This allows you to know if all order
>>> was validated or not.
>>>
>>> See the section - Split aggregate request/reply sample
>>> On the splitter EIP page
>>>
>>>
>>> >
>>> > Regards,
>>> >
>>> > Charles Moulliard
>>> > Senior Enterprise Architect
>>> > Apache Camel Committer
>>> >
>>> > *****************************
>>> > blog : http://cmoulliard.blogspot.com
>>> >
>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> Apache Camel Committer
>>>
>>> Open Source Integration: http://fusesource.com
>>> Blog: http://davsclaus.blogspot.com/
>>> Twitter: http://twitter.com/davsclaus
>>>
>>
>>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Mime
View raw message