You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Charles Moulliard <ch...@gmail.com> on 2013/09/27 17:05:15 UTC

Workaround interceptFrom().transacted()

Hi,

Since Camel 2.12, the following syntax is not longer tolerated/accepted. Is
there a workaround ....

    public void testInvalidTransactedInterceptFrom() throws Exception {
        try {
            context.addRoutes(new RouteBuilder() {
                @Override
                public void configure() throws Exception {

                    interceptFrom().transacted();

                    from("direct:start")
                            .split(body())
                            .to("mock:split")
                            .end();
                }
            });
            fail("Should fail");
        } catch (IllegalArgumentException e) {
            assertTrue(e.getMessage().startsWith("The output must be added
as top-level on the route."));
        }
    }

Regards,

-- 
Charles Moulliard
Apache Committer / Architect @RedHat
Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com

Fwd: Workaround interceptFrom().transacted()

Posted by Charles Moulliard <ch...@gmail.com>.
Hi,

Since Camel 2.12, the following syntax is not longer tolerated/accepted. Is
there a workaround ....

    public void testInvalidTransactedInterceptFrom() throws Exception {
        try {
            context.addRoutes(new RouteBuilder() {
                @Override
                public void configure() throws Exception {

                    interceptFrom().transacted();

                    from("direct:start")
                            .split(body())
                            .to("mock:split")
                            .end();
                }
            });
            fail("Should fail");
        } catch (IllegalArgumentException e) {
            assertTrue(e.getMessage().startsWith("The output must be added
as top-level on the route."));
        }
    }

Regards,

-- 
Charles Moulliard
Apache Committer / Architect @RedHat
Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com




-- 
Charles Moulliard
Apache Committer / Architect @RedHat
Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com

Re: Workaround interceptFrom().transacted()

Posted by Charles Moulliard <ch...@gmail.com>.
AdviceWith can only be used for unit test.
The problem that the customer would like to solve is the following :
Customer has developed some classes that the project will use to develop
Camel routes. These classes are abstract RouteBuilder class where
strategies have been developed to handle functional, technical Exception
but also transaction behavior. Advantage is that the developer does not
need to add .transacted in their routes.


On Tue, Oct 1, 2013 at 9:18 AM, Claus Ibsen <cl...@gmail.com> wrote:

> Use advice-with if you wanna "mess around" with routes.
>
>
> On Fri, Sep 27, 2013 at 5:05 PM, Charles Moulliard <ch...@gmail.com>
> wrote:
> > Hi,
> >
> > Since Camel 2.12, the following syntax is not longer tolerated/accepted.
> Is
> > there a workaround ....
> >
> >     public void testInvalidTransactedInterceptFrom() throws Exception {
> >         try {
> >             context.addRoutes(new RouteBuilder() {
> >                 @Override
> >                 public void configure() throws Exception {
> >
> >                     interceptFrom().transacted();
> >
> >                     from("direct:start")
> >                             .split(body())
> >                             .to("mock:split")
> >                             .end();
> >                 }
> >             });
> >             fail("Should fail");
> >         } catch (IllegalArgumentException e) {
> >             assertTrue(e.getMessage().startsWith("The output must be
> added
> > as top-level on the route."));
> >         }
> >     }
> >
> > Regards,
> >
> > --
> > Charles Moulliard
> > Apache Committer / Architect @RedHat
> > Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.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
>



-- 
Charles Moulliard
Apache Committer / Architect @RedHat
Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com

Re: Workaround interceptFrom().transacted()

Posted by Claus Ibsen <cl...@gmail.com>.
Use advice-with if you wanna "mess around" with routes.


On Fri, Sep 27, 2013 at 5:05 PM, Charles Moulliard <ch...@gmail.com> wrote:
> Hi,
>
> Since Camel 2.12, the following syntax is not longer tolerated/accepted. Is
> there a workaround ....
>
>     public void testInvalidTransactedInterceptFrom() throws Exception {
>         try {
>             context.addRoutes(new RouteBuilder() {
>                 @Override
>                 public void configure() throws Exception {
>
>                     interceptFrom().transacted();
>
>                     from("direct:start")
>                             .split(body())
>                             .to("mock:split")
>                             .end();
>                 }
>             });
>             fail("Should fail");
>         } catch (IllegalArgumentException e) {
>             assertTrue(e.getMessage().startsWith("The output must be added
> as top-level on the route."));
>         }
>     }
>
> Regards,
>
> --
> Charles Moulliard
> Apache Committer / Architect @RedHat
> Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.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