You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Søren Heintzelmann Therkildsen <So...@Systematic.com> on 2016/02/15 19:38:39 UTC

Using NotifyBuilder

Hi.

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 {

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

                from("direct:a")
                        .routeId("a")
                        .log("Finished route a");
            }
        };
    }

    @Test
    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);
    }
}

Re: Using NotifyBuilder

Posted by SHTherkildsen <So...@Systematic.com>.
Upgrading from 2.15.3 to 2.16.2 did the trick. 

Thanks.



--
View this message in context: http://camel.465427.n5.nabble.com/Using-NotifyBuilder-tp5777762p5777765.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Using NotifyBuilder

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Try upgrading Camel if you are not using a new version.

See some pointers here
http://camel.apache.org/support.html

On Mon, Feb 15, 2016 at 7:38 PM, Søren Heintzelmann Therkildsen
<So...@systematic.com> wrote:
> Hi.
>
> 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 {
>
>     @Override
>     protected RouteBuilder createRouteBuilder() throws Exception {
>         return new RouteBuilder() {
>             @Override
>             public void configure() throws Exception {
>
>                 from("direct:a")
>                         .routeId("a")
>                         .log("Finished route a");
>             }
>         };
>     }
>
>     @Test
>     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);
>     }
> }



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2