You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Steve973 <st...@gmail.com> on 2018/05/10 14:26:53 UTC
How can I include common behavior in several routes?
Hello. If I want, for example, to have several of my routes to be "status
aware", how might I achieve this? What I mean by "status aware" is that
the route will start, notify a component that the workflow has begun, then
it will conduct route-specific logic, and when that is complete, it will
notify a component that the workflow has completed. This is almost like
AOP in concept, so I would like to be able to define this behavior in one
place and include it in some number of routes that need to use this
behavior. Is there a way that I can accomplish this? I saw that there is
adviceWith for testing, but I need this for regular operation. Thanks in
advance.
Steve
Re: How can I include common behavior in several routes?
Posted by Steve973 <st...@gmail.com>.
Thanks, everyone. I did get an answer on SO, and it was also what Quinn
Stevenson suggested. I am creating a custom RoutePolicy class that extends
from RoutePolicySupport. In onExchangeBegin and onExchangeDone, I am
creating a new exchange and sending it to the status endpoints via a fluent
producer template. If this sounds bad to anyone, please let me know.
On Thu, May 10, 2018 at 3:14 PM, Jan Bednář <ma...@janbednar.eu> wrote:
> Steve already got answer on SO. https://stackoverflow.com/ques
> tions/50275601/how-can-i-include-common-behavior-in-several-
> apache-camel-routes
>
>
Re: How can I include common behavior in several routes?
Posted by Jan Bednář <ma...@janbednar.eu>.
Steve already got answer on SO.
https://stackoverflow.com/questions/50275601/how-can-i-include-common-behavior-in-several-apache-camel-routes
Re: How can I include common behavior in several routes?
Posted by Owain McGuire <ow...@integration.technology>.
Steve,
My rudimentary reading of your question would suggest to me that what you are talking about is an common InOut route. So define a direct:commonRoute and then use it in the applicable routes. Or if it is more sophisticated, look at using a RouteBuilder class.
HTH.
O.
> aware", how might I achieve this? What I mean by "status aware" is that
> the route will start, notify a component that the workflow has begun, then
> it will conduct route-specific logic, and when that is complete, it will
> notify a component that the workflow has completed. This is almost like
> AOP in concept, so I would like to be able to define this behavior in one
> place and include it in some number of routes that need to use this
> behavior. Is there a way that I can accomplish this? I saw that there is
> adviceWith for testing, but I need this for regular operation. Thanks in
> advance.
>
> Steve
Re: How can I include common behavior in several routes?
Posted by Quinn Stevenson <qu...@pronoia-solutions.com>.
Have you looked at using a RoutePolicy?
http://camel.apache.org/routepolicy.html <http://camel.apache.org/routepolicy.html>
> On May 10, 2018, at 8:26 AM, Steve973 <st...@gmail.com> wrote:
>
> Hello. If I want, for example, to have several of my routes to be "status
> aware", how might I achieve this? What I mean by "status aware" is that
> the route will start, notify a component that the workflow has begun, then
> it will conduct route-specific logic, and when that is complete, it will
> notify a component that the workflow has completed. This is almost like
> AOP in concept, so I would like to be able to define this behavior in one
> place and include it in some number of routes that need to use this
> behavior. Is there a way that I can accomplish this? I saw that there is
> adviceWith for testing, but I need this for regular operation. Thanks in
> advance.
>
> Steve