You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Norman Maurer <no...@apache.org> on 2010/04/01 13:52:52 UTC

Using transacted() in routes and disposing Body

Hi all,

I'm using transacted() on many routes which works very well so far.
But to be sure all resources are recycled I need to call a dispose()
method on my object which is hold in the Body of the Message of the
Exchange. How would I configure camel to call the method on the Body
and then just continue to use thr TransactionErrorHandler ?

Is it possible ?

Thx,
Norman

Re: Using transacted() in routes and disposing Body

Posted by Norman Maurer <no...@googlemail.com>.
Ah thx,

I thought this will prevent to call the TransactionHandler then..

Bye,
Norman


2010/4/1 Claus Ibsen <cl...@gmail.com>:
> On Thu, Apr 1, 2010 at 2:15 PM, Norman Maurer
> <no...@googlemail.com> wrote:
>> Hi Claus,
>>
>> I already do the processor stuff on the end of the route. I need to
>> call the dispose stuff when an exception accours while processing the
>> route. It should get called before the transaction is rolled back. I'm
>> using java dsl for building the routes..
>>
>
> You should then be able to do
>
> from(xxx)
> .transacted()
> .onException(Exception.class).process(myCallDisposeProcessor).end()
> .to(yyy)
> .to(zzz);
>
> If you need to do that on all routes you can let onException be
> configured on context scope instead of route scope as above.
>
>
>> Thx,
>> Norman
>>
>>
>> 2010/4/1 Claus Ibsen <cl...@gmail.com>:
>>> Do you need to call dispose at the end of the route?
>>>
>>> You could just add a .process step and invoke it from java code?
>>>
>>> Or maybe use onCompletion to abstract that into its own route?
>>> http://camel.apache.org/oncompletion.html
>>>
>>>
>>>
>>> On Thu, Apr 1, 2010 at 1:52 PM, Norman Maurer <no...@apache.org> wrote:
>>>> Hi all,
>>>>
>>>> I'm using transacted() on many routes which works very well so far.
>>>> But to be sure all resources are recycled I need to call a dispose()
>>>> method on my object which is hold in the Body of the Message of the
>>>> Exchange. How would I configure camel to call the method on the Body
>>>> and then just continue to use thr TransactionErrorHandler ?
>>>>
>>>> Is it possible ?
>>>>
>>>> Thx,
>>>> Norman
>>>>
>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> Apache Camel Committer
>>>
>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>> Open Source Integration: http://fusesource.com
>>> Blog: http://davsclaus.blogspot.com/
>>> Twitter: http://twitter.com/davsclaus
>>>
>>
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
>

Re: Using transacted() in routes and disposing Body

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Apr 1, 2010 at 2:15 PM, Norman Maurer
<no...@googlemail.com> wrote:
> Hi Claus,
>
> I already do the processor stuff on the end of the route. I need to
> call the dispose stuff when an exception accours while processing the
> route. It should get called before the transaction is rolled back. I'm
> using java dsl for building the routes..
>

You should then be able to do

from(xxx)
.transacted()
.onException(Exception.class).process(myCallDisposeProcessor).end()
.to(yyy)
.to(zzz);

If you need to do that on all routes you can let onException be
configured on context scope instead of route scope as above.


> Thx,
> Norman
>
>
> 2010/4/1 Claus Ibsen <cl...@gmail.com>:
>> Do you need to call dispose at the end of the route?
>>
>> You could just add a .process step and invoke it from java code?
>>
>> Or maybe use onCompletion to abstract that into its own route?
>> http://camel.apache.org/oncompletion.html
>>
>>
>>
>> On Thu, Apr 1, 2010 at 1:52 PM, Norman Maurer <no...@apache.org> wrote:
>>> Hi all,
>>>
>>> I'm using transacted() on many routes which works very well so far.
>>> But to be sure all resources are recycled I need to call a dispose()
>>> method on my object which is hold in the Body of the Message of the
>>> Exchange. How would I configure camel to call the method on the Body
>>> and then just continue to use thr TransactionErrorHandler ?
>>>
>>> Is it possible ?
>>>
>>> Thx,
>>> Norman
>>>
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Author of Camel in Action: http://www.manning.com/ibsen/
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: Using transacted() in routes and disposing Body

Posted by Norman Maurer <no...@googlemail.com>.
Hi Claus,

I already do the processor stuff on the end of the route. I need to
call the dispose stuff when an exception accours while processing the
route. It should get called before the transaction is rolled back. I'm
using java dsl for building the routes..

Thx,
Norman


2010/4/1 Claus Ibsen <cl...@gmail.com>:
> Do you need to call dispose at the end of the route?
>
> You could just add a .process step and invoke it from java code?
>
> Or maybe use onCompletion to abstract that into its own route?
> http://camel.apache.org/oncompletion.html
>
>
>
> On Thu, Apr 1, 2010 at 1:52 PM, Norman Maurer <no...@apache.org> wrote:
>> Hi all,
>>
>> I'm using transacted() on many routes which works very well so far.
>> But to be sure all resources are recycled I need to call a dispose()
>> method on my object which is hold in the Body of the Message of the
>> Exchange. How would I configure camel to call the method on the Body
>> and then just continue to use thr TransactionErrorHandler ?
>>
>> Is it possible ?
>>
>> Thx,
>> Norman
>>
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
>

Re: Using transacted() in routes and disposing Body

Posted by Claus Ibsen <cl...@gmail.com>.
Do you need to call dispose at the end of the route?

You could just add a .process step and invoke it from java code?

Or maybe use onCompletion to abstract that into its own route?
http://camel.apache.org/oncompletion.html



On Thu, Apr 1, 2010 at 1:52 PM, Norman Maurer <no...@apache.org> wrote:
> Hi all,
>
> I'm using transacted() on many routes which works very well so far.
> But to be sure all resources are recycled I need to call a dispose()
> method on my object which is hold in the Body of the Message of the
> Exchange. How would I configure camel to call the method on the Body
> and then just continue to use thr TransactionErrorHandler ?
>
> Is it possible ?
>
> Thx,
> Norman
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus