"deadLetterChannel" access from process()

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

"deadLetterChannel" access from process()

pevgen
Hi.

How can I get "deadLetterChannel" object in my "Processor.process()" method ?

I wont to change RedeliveryPolicy in runtime. for example, i need stop increase delay time after X attempts.

Thanks
Evgeny
Reply | Threaded
Open this post in threaded view
|

Re: "deadLetterChannel" access from process()

jstrachan
2008/6/19 pevgen <[hidden email]>:
> Hi.
>
> How can I get "deadLetterChannel" object in my "Processor.process()" method
> ?
>
> I wont to change RedeliveryPolicy in runtime. for example, i need stop
> increase delay time after X attempts.

You're best bet is to use dependency injection.

e.g. create a custom policy, then inject it into your custom Processor.

myCustomDeadLetterChannel = ...;

myCustomProcessor = new MyCustomProcessor(myCustomDeadLetterChannel);

from("foo").process(myCustomProcessor);


Or using spring to do dependency injection if you use spring.xml instead.

--
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com
Reply | Threaded
Open this post in threaded view
|

Re: "deadLetterChannel" access from process()

pevgen
Thank you, James

But, if my route like this :

from("jms:...").errorHandler(deadLetter()).process(myProcess).to("http://host1/example")

and "to"-endpoint throw an exception, then i wont repeat like RedeliveryPolicy.

I don't wont change the route :
from("jms:...").process(myProcess)
and create "http" -endpoint during runtime in "myProcess", but i wont to manage redelivery schedule only.

can i do it ?

Thanks
Evgeny
 

James.Strachan wrote
2008/6/19 pevgen <pevgen@km.ru>:
> Hi.
>
> How can I get "deadLetterChannel" object in my "Processor.process()" method
> ?
>
> I wont to change RedeliveryPolicy in runtime. for example, i need stop
> increase delay time after X attempts.

You're best bet is to use dependency injection.

e.g. create a custom policy, then inject it into your custom Processor.

myCustomDeadLetterChannel = ...;

myCustomProcessor = new MyCustomProcessor(myCustomDeadLetterChannel);

from("foo").process(myCustomProcessor);


Or using spring to do dependency injection if you use spring.xml instead.

--
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com