Hi Peter,
Imho not easily, because there is no way today to identify/address a
node in the AST. I can think of two things that may work.
One is to sorta artificially split the route in two using a direct
endpoint:
from(x).somestuff().to("direct"a");
from("direct:a").restoftheroute();
and later on stop the routes and replace the second one with
from("direct:a").process(MyProcessor).restoftheroute();
The second option is to use a DelegateProcessor in the middle of the
route that delegates to a noop processor which you can later replace
with a processor of your choice.
In the first case you'd need to know with some approximation where you
want to insert your processor, in the second case you need to know
exactly where it should be injected. There's nothing better I can
think of now, if anybody has a better idea, please shout.
I hope this helps,
Hadrian
On Apr 22, 2009, at 8:52 AM, Peter Maas wrote:
Hi,
is it possible the programmatically replace parts of a route (for
testing purposes) to temporarily add processor in the middle of the
route for example? One case I (think) I need it for is for testing
unexpected errors, I'd like to mimic this by 'injecting' a processor
which throws a unchecked exception; the ErrorHandlerTest does do
this but only with custom routes...
any ideas?
Peter