I've read the page on NotifyBuilder but I don't think I really understood how
it works. So I wrote below test case to verify it. The results confound me.

(The Groovy script is standalone and fully functioning so feel free to run
it locally.)

Code
===

@Grab(group='org.apache.camel', module = 'camel-core', version='2.15.1')
import java.util.concurrent.TimeUnit
import org.apache.camel.builder.*
import org.apache.camel.impl.DefaultCamelContext

def context = new DefaultCamelContext()
context.addRoutes(new RouteBuilder() {
                void configure() {
                        from('direct:route1').routeId('route1')
                                .log('route 1 started')
                                .to('direct:route2')
                                .log('route 1 ended')
                        from('direct:route2').routeId('route2')
                                .log('route 2 started')
                                .to('direct:route3')
                                .log('route 2 ended')
                        from('direct:route3').routeId('route3')
                                .log('route 3 started and ended')
                }
        })
context.start()

def notifies = [
        new
NotifyBuilder(context).from('direct:route1').whenExactlyDone(1).create(),
        new
NotifyBuilder(context).from('direct:route2').whenExactlyDone(1).create(),
        new
NotifyBuilder(context).from('direct:route3').whenExactlyDone(1).create(),
        new
NotifyBuilder(context).whenExactlyDone(1).from('direct:route1').create(),
        new
NotifyBuilder(context).whenExactlyDone(1).from('direct:route2').create(),
        new
NotifyBuilder(context).whenExactlyDone(1).from('direct:route3').create()
]
context.createProducerTemplate().requestBody 'direct:route1', 'something'
notifies.eachWithIndex { it, i -> println "$i: ${it.matches()}"  }


STDOUT
===

0: true
1: false
2: false
3: true
4: true
5: true


I understand the predicates are stacked but can someone please explain the
above behaviour to me?



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

Reply via email to