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: Append endpoint to route at test-time.
Date Tue, 10 May 2011 11:55:38 GMT
On Sun, May 8, 2011 at 1:44 PM, Tarjei Huse <tarjei@scanmine.com> wrote:
> Hi,
>
> I got a route like this:
> from(bookKeeperQueue).routeId("BookKeeperRoute")
>            .process(new BookKeeperProcessor(bookKeeper));
>
> That I would like to test by appending a mock endpoint to the route and
> avaiting for it to receive the message.
>
> I could add a .to(log:something) at the end of the route, but I would
> find it more pleasing if I could just append an endpoint to the route
> using the new adviceWith() functionality.
>
> Is this possible?
>

In Camel 2.8 you can now do

context.getRouteDefinitions().get(0).adviceWith(context, new
AdviceWithRouteBuilder() {
    @Override
    public void configure() throws Exception {
        // send the outgoing message to mock:output
        weaveAddLast().to("mock:output");
    }
});

See details at
https://cwiki.apache.org/confluence/display/CAMEL/AdviceWith


> --
> Regards / Med vennlig hilsen
> Tarjei Huse
> Mobil: 920 63 413
>
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
CamelOne 2011: http://fusesource.com/camelone2011/
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Mime
View raw message