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

Claus Ibsen commented on CAMEL-1660:
------------------------------------

And the special *finally* variation

{code:xml}
    <!-- START SNIPPET: e1 -->
    <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring";>
        <route>
            <!-- we have a request/reply messaging where we have a direct 
endpoint for inputs and
                 we want to log all in and out of this endpoint -->
            <from uri="direct:start"/>
            <!-- so we use AOP around to send the message to the before and 
after endpoints so we log
                 the input and output to the direct:start endpoint.
                 We use a afterFinallyUri to instruct Camel to send to this 
destination even in case
                 of an exception, it mirros the finally block in regular java.
                 Notice: we must include the route nested in the AOP tag to let 
Camel know what it should
                 span around -->
            <aop beforeUri="mock:before" afterFinallyUri="mock:after">
                <!-- this is the regular route where we construct a response 
message -->
                <transform><constant>Bye World</constant></transform>
                <to uri="mock:result"/>
            </aop>
        </route>
    </camelContext>
    <!-- END SNIPPET: e1 -->
{code}

> A lite AOP feature in the DSL
> -----------------------------
>
>                 Key: CAMEL-1660
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1660
>             Project: Apache Camel
>          Issue Type: New Feature
>          Components: camel-core
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.0.0
>
>         Attachments: CAMEL-1660.patch
>
>
> We could use a lite AOP in the DSL, allowing you to easy invoke an endpoint 
> before/after the route.
> {code}
>                 from("direct:start")
>                     .aop().around("mock:before", "mock:after")
>                     .transform(constant("Bye World")).to("mock:result");
> {code}
> In the route above we have defined an AOP *around* where we invoke the before 
> and after endpoints.
> This DSL only supports setting the *before* and *after* as a endpoint URI. 
> We have the following DSL operations
> - before
> - after
> - around
> - afterFinally
> - aroundFinally
> The finally version will invoke the after in a finally block to ensure its 
> always executed even if an exception occurred.

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

Reply via email to