You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by berhack <ro...@gmail.com> on 2013/09/19 13:03:47 UTC

Questions on NotifyBuilder

This is great for creating coarse grained expectations on routes, but I am
struggling with the documentation.

Hoping the experts can help me answer the questions, based on the given
example:

from(direct:hello).process().to(direct:foo)

from(direct:foo).process().to(direct:bar)

from(direct:bar).multicast/recipientlist

1) on creation within a CamelSpringTestSupport test, does it matter where we
create the notify builder?  I guess as long as it is before sending message
to direct:hello?  Can camel context be already started?  What about waiting
for matches to return?  I guess we do that after sending the message?

2) What is considered "completed" for an exchange anyway?  If I create my NB
with .from(direct:hello).whenCompleted(1) will that match after it passes
through direct:foo?  Or direct:bar?  Maybe this depends on whether a new
exchange is created between direct invocations, I could not find info on
this either.

3) If I create an NB from direct:foo, but start the messaging from
direct:hello, will that still match?  I could not get this to work (matching
times out).

4) Related to #2, in the multicast or recipientlist pattern, when will
whenCompleted(1) match?  Will it match as soon as the exchange is routed to
the multicast or recipientlist, or when the route completes.



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

Re: Questions on NotifyBuilder

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Sep 19, 2013 at 1:03 PM, berhack <ro...@gmail.com> wrote:
> This is great for creating coarse grained expectations on routes, but I am
> struggling with the documentation.
>
> Hoping the experts can help me answer the questions, based on the given
> example:
>
> from(direct:hello).process().to(direct:foo)
>
> from(direct:foo).process().to(direct:bar)
>
> from(direct:bar).multicast/recipientlist
>
> 1) on creation within a CamelSpringTestSupport test, does it matter where we
> create the notify builder?  I guess as long as it is before sending message
> to direct:hello?  Can camel context be already started?  What about waiting
> for matches to return?  I guess we do that after sending the message?
>

Yeah you can create NotifyBuilder in your test method, even after
CamelContext has been started.


> 2) What is considered "completed" for an exchange anyway?  If I create my NB
> with .from(direct:hello).whenCompleted(1) will that match after it passes
> through direct:foo?  Or direct:bar?  Maybe this depends on whether a new
> exchange is created between direct invocations, I could not find info on
> this either.
>

Read the javadoc. Completed is when the exchange is completed being routed.
Notice there is a difference between completed vs done. See the javadoc.



> 3) If I create an NB from direct:foo, but start the messaging from
> direct:hello, will that still match?  I could not get this to work (matching
> times out).
>

Read the javadoc. from is where the exchange originates from (eg where
it was first created)


> 4) Related to #2, in the multicast or recipientlist pattern, when will
> whenCompleted(1) match?  Will it match as soon as the exchange is routed to
> the multicast or recipientlist, or when the route completes.
>

These EIPs creates new sub exchanges which is also counted in the completed.


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



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen