camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Søren Heintzelmann Therkildsen <>
Subject Using NotifyBuilder
Date Mon, 15 Feb 2016 18:38:39 GMT

I am trying to use NotifyBuilder, but I just don't understand it. I have a simple example
below that is failing (matches() times out). 

Can anyone tell me what I am doing wrong. It must be something simple. :)

import org.apache.camel.Exchange;
import org.apache.camel.builder.NotifyBuilder;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.DefaultExchange;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;

import java.util.concurrent.TimeUnit;

public class RouteNotDone extends CamelTestSupport {

    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            public void configure() throws Exception {

                        .log("Finished route a");

    public void testNotDone() {
        NotifyBuilder nb = new NotifyBuilder(context).fromRoute("a").whenDone(1).create();
        Exchange exchange = new DefaultExchange(context);
        exchange = template.send("direct:a", exchange);
        boolean done = nb.matches(10, TimeUnit.SECONDS);
        assertTrue("Not done in 10 seconds", done);

View raw message