You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2010/01/13 17:25:43 UTC

[jira] Commented: (CAMEL-2357) ExchangeNotifierBuilder - Add a builder to building exchange notification predicates to be used for testing

    [ https://issues.apache.org/activemq/browse/CAMEL-2357?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=56891#action_56891 ] 

Claus Ibsen commented on CAMEL-2357:
------------------------------------

Btw the from is optional you can do
{code}
        ExchangeNotifierBuilder builder = new ExchangeNotifierBuilder(context)
                .whenExchangeDone(5)
                .not().whenExchangeFailed(1)
                .create();
{code}

Just to indicate any 5 done but none should be failed.

And the from is using wildcard matching just like the interceptors so you can do {{from("jms*")}} to indicate any JMS. 

> ExchangeNotifierBuilder - Add a builder to building exchange notification predicates to be used for testing
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-2357
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2357
>             Project: Apache Camel
>          Issue Type: New Feature
>          Components: camel-core
>    Affects Versions: 2.1.0
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.2.0
>
>
> When doing unit testing and you do not use mocks or the likes to test when X number of message have completed etc.
> Then we need some other form to do that and a fairly lightweight and simple builder can offer this in a intuitive way.
> {code}
>         ExchangeNotifierBuilder builder = new ExchangeNotifierBuilder(context)
>                 .from("direct:foo").whenExchangeDone(5)
>                 .create();
> {code}
> And you can stack with operations such as *and, or, not* etc:
> {code}
>         ExchangeNotifierBuilder builder = new ExchangeNotifierBuilder(context)
>                 .from("direct:foo").whenExchangeDone(5)
>                 .or().from("direct:bar").whenExchangeDone(7)
>                 .create();
> {code}
> Then you just assert whether it matched and there should be methods to wait as well
> {code}
>         assertEquals(true, builder.matches());
> {code}
> As well as a method to invoke a callback when its matching.
> On top we can add to the builder so you can do fine grained expressions to indicate when this message is complete, or when 5 messages with header amount > 100 is complete etc.
> Basically if we can tap in the other builders then you would be able to archive that

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.