You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by ext2 <xu...@tongtech.com> on 2010/10/22 06:01:54 UTC

how to implement the instrumentation of from-endpoint?(Should camel to support the route level interceptor)


Hi: 
	Camel support interceptors for processor, but recently I encounter a
requirement, it ask for a custom instrumentation strategy of from endpoint;
for example , we need the statistics of how much times the message is
successfully processed in a given time, and how much message is failed;

	I think we could have three choice to achieve such purpose.
	1) Do instrument things, in the from-endpoint. 
		it's bad, because it need to change the code of camel's
consumer

	2) Extend a policy processor to wrapper the whole route, and do
measurement
		It seems the solution is too heavy. But the solution does
works, and now I am using this solution in my work;

	3) Support a route level interceptor (just like the processor's
interceptor, but it will wrapper the whole route).
	It seems the solution is more lightweight than the policy-processor.
How about to add such the support in camel?

Thanks any suggestion
	
	
		 



Re: how to implement the instrumentation of from-endpoint?(Should camel to support the route level interceptor)

Posted by ext2 <xu...@tongtech.com>.
Thanks a lot. 
It's just what I needed;

---------------------------------------------------------------------------

on 2010/10/22 12:38 Willem Jiang [mailto:willem.jiang@gmail.com] wrote
Re: how to implement the instrumentation of from-endpoint?(Should camel to
support the route level interceptor)

There is an InterceptFrom DSL[1] that can meet you requirement.

[1]http://camel.apache.org/intercept.html#Intercept-InterceptFrom

On 10/22/10 12:01 PM, ext2 wrote:
>
>
> Hi:
> 	Camel support interceptors for processor, but recently I encounter a
> requirement, it ask for a custom instrumentation strategy of from
endpoint;
> for example , we need the statistics of how much times the message is
> successfully processed in a given time, and how much message is failed;
>
> 	I think we could have three choice to achieve such purpose.
> 	1) Do instrument things, in the from-endpoint.
> 		it's bad, because it need to change the code of camel's
> consumer
>
> 	2) Extend a policy processor to wrapper the whole route, and do
> measurement
> 		It seems the solution is too heavy. But the solution does
> works, and now I am using this solution in my work;
>
> 	3) Support a route level interceptor (just like the processor's
> interceptor, but it will wrapper the whole route).
> 	It seems the solution is more lightweight than the policy-processor.
> How about to add such the support in camel?
>
> Thanks any suggestion
> 	
> 	
> 		
>
>
>


-- 
Willem
----------------------------------
Open Source Integration: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: http://twitter.com/willemjiang




Re: how to implement the instrumentation of from-endpoint?(Should camel to support the route level interceptor)

Posted by Willem Jiang <wi...@gmail.com>.
There is an InterceptFrom DSL[1] that can meet you requirement.

[1]http://camel.apache.org/intercept.html#Intercept-InterceptFrom

On 10/22/10 12:01 PM, ext2 wrote:
>
>
> Hi:
> 	Camel support interceptors for processor, but recently I encounter a
> requirement, it ask for a custom instrumentation strategy of from endpoint;
> for example , we need the statistics of how much times the message is
> successfully processed in a given time, and how much message is failed;
>
> 	I think we could have three choice to achieve such purpose.
> 	1) Do instrument things, in the from-endpoint.
> 		it's bad, because it need to change the code of camel's
> consumer
>
> 	2) Extend a policy processor to wrapper the whole route, and do
> measurement
> 		It seems the solution is too heavy. But the solution does
> works, and now I am using this solution in my work;
>
> 	3) Support a route level interceptor (just like the processor's
> interceptor, but it will wrapper the whole route).
> 	It seems the solution is more lightweight than the policy-processor.
> How about to add such the support in camel?
>
> Thanks any suggestion
> 	
> 	
> 		
>
>
>


-- 
Willem
----------------------------------
Open Source Integration: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: http://twitter.com/willemjiang

Re: Could camel support configurable interceptor strategy in spring?

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Oct 22, 2010 at 9:19 AM, ext2 <xu...@tongtech.com> wrote:
> Hi, Clause:
>
> Thanks a lot;
> I am sorry for my poor knowledge about Orader.
>  I have just reviewed the source code of camel-core, camel-spring,camel-xml.
> But I haven't found the source code to control the wrapper-sequence of
> interceptor strategy by Ordered;
>
> Do you means my interceptor-strategy can implement the Ordered interface ,
> then the camel could sequence  to load these strategies by the order?
>
> For example if I write two interceptor-strategy(A , B), if A's order is 0,
> and B's order is 1. the camel will always wrapper the processor as
> {A{B{Processor}}.
>

Yeah something like that AFAIR.


>
> ============================================================================
> On Fri, Oct 22, 2010  Claus Ibsen [mailto:claus.ibsen@gmail.com] wrote:
> Re:  Could camel support configurable interceptor strategy in spring?
>
> On Fri, Oct 22, 2010 at 7:39 AM, ext2 <xu...@tongtech.com> wrote:
>> Thanks a lot. I see;
>>
>> Camel could look up all the configured interceptor-strategies in spring
>> application context. But unfortunately, it seems we couldn't control the
>> wrap order of interceptor-strategies;
>>
>
> Can you try implement the org.apache.camel.util.Ordered interface from
> Camel and that way control the order.
>
>
>>
> ============================================================================
>> On 2010/10/22 12:29 Willem Jiang Wrote
>>  Re: Could camel support configurable interceptor strategy in spring?
>>
>> You can just add the InterceptorStrategies into the application,
>> CamelContextFactoryBean will pick up these interceptorStrategies and set
>> them into the camelContext.
>>
>> You can find the code in the afterPropertiesSet() method of
>> AbstractCamelContextFactoryBean[1].
>>
>>
> [1]https://svn.apache.org/repos/asf/camel/trunk/components/camel-core-xml/sr
>> c/main/java/org/apache/camel/core/xml/AbstractCamelContextFactoryBean.java
>>
>> On 10/22/10 12:15 PM, ext2 wrote:
>>> Hi:
>>>       Camel's Context support a low level
>>> API(CamelContext.addInterceptStrategy), which we could use it to add our
>>> custom interceptor-strategy in Java  DSL program;
>>>       But while using Spring DSL, it seems there is no such a
>>> configuration we can use to configure the custom interceptor-strategy;
>>>       How about to add such a support?
>>>
>>>       It may looks like as following:
>>>       <beans>
>>>               <bean id="interceptorStrategyList"
>>> class="org.apache.camel.InterceptorStrategyList ">
>>>               <camel:context>
>>>                       ...
>>>               </camel:context>
>>>       </beans>
>>>       The bean "interceptorStrategyList" support a method to return a
> list
>>> of custom interceptor strategy; And camel-spring could find the bean and
>>> register the interceptors into camelContext;
>>>
>>> Thanks any suggestion
>>>
>>>
>>>
>>
>>
>> --
>> Willem
>> ----------------------------------
>> Open Source Integration: http://www.fusesource.com
>> Blog:    http://willemjiang.blogspot.com (English)
>>          http://jnn.javaeye.com (Chinese)
>> Twitter: http://twitter.com/willemjiang
>>
>>
>>
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
>
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: Could camel support configurable interceptor strategy in spring?

Posted by ext2 <xu...@tongtech.com>.
Hi, Clause:

Thanks a lot; 
I am sorry for my poor knowledge about Orader. 
 I have just reviewed the source code of camel-core, camel-spring,camel-xml.
But I haven't found the source code to control the wrapper-sequence of
interceptor strategy by Ordered;

Do you means my interceptor-strategy can implement the Ordered interface ,
then the camel could sequence  to load these strategies by the order? 

For example if I write two interceptor-strategy(A , B), if A's order is 0,
and B's order is 1. the camel will always wrapper the processor as
{A{B{Processor}}.

	
============================================================================
On Fri, Oct 22, 2010  Claus Ibsen [mailto:claus.ibsen@gmail.com] wrote:
Re:  Could camel support configurable interceptor strategy in spring?

On Fri, Oct 22, 2010 at 7:39 AM, ext2 <xu...@tongtech.com> wrote:
> Thanks a lot. I see;
>
> Camel could look up all the configured interceptor-strategies in spring
> application context. But unfortunately, it seems we couldn't control the
> wrap order of interceptor-strategies;
>

Can you try implement the org.apache.camel.util.Ordered interface from
Camel and that way control the order.


>
============================================================================
> On 2010/10/22 12:29 Willem Jiang Wrote
>  Re: Could camel support configurable interceptor strategy in spring?
>
> You can just add the InterceptorStrategies into the application,
> CamelContextFactoryBean will pick up these interceptorStrategies and set
> them into the camelContext.
>
> You can find the code in the afterPropertiesSet() method of
> AbstractCamelContextFactoryBean[1].
>
>
[1]https://svn.apache.org/repos/asf/camel/trunk/components/camel-core-xml/sr
> c/main/java/org/apache/camel/core/xml/AbstractCamelContextFactoryBean.java
>
> On 10/22/10 12:15 PM, ext2 wrote:
>> Hi:
>>       Camel's Context support a low level
>> API(CamelContext.addInterceptStrategy), which we could use it to add our
>> custom interceptor-strategy in Java  DSL program;
>>       But while using Spring DSL, it seems there is no such a
>> configuration we can use to configure the custom interceptor-strategy;
>>       How about to add such a support?
>>
>>       It may looks like as following:
>>       <beans>
>>               <bean id="interceptorStrategyList"
>> class="org.apache.camel.InterceptorStrategyList ">
>>               <camel:context>
>>                       ...
>>               </camel:context>
>>       </beans>
>>       The bean "interceptorStrategyList" support a method to return a
list
>> of custom interceptor strategy; And camel-spring could find the bean and
>> register the interceptors into camelContext;
>>
>> Thanks any suggestion
>>
>>
>>
>
>
> --
> Willem
> ----------------------------------
> Open Source Integration: http://www.fusesource.com
> Blog:    http://willemjiang.blogspot.com (English)
>          http://jnn.javaeye.com (Chinese)
> Twitter: http://twitter.com/willemjiang
>
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus



Re: : Could camel support configurable interceptor strategy in spring?

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Oct 22, 2010 at 7:39 AM, ext2 <xu...@tongtech.com> wrote:
> Thanks a lot. I see;
>
> Camel could look up all the configured interceptor-strategies in spring
> application context. But unfortunately, it seems we couldn't control the
> wrap order of interceptor-strategies;
>

Can you try implement the org.apache.camel.util.Ordered interface from
Camel and that way control the order.


> ============================================================================
> On 2010/10/22 12:29 Willem Jiang Wrote
>  Re: Could camel support configurable interceptor strategy in spring?
>
> You can just add the InterceptorStrategies into the application,
> CamelContextFactoryBean will pick up these interceptorStrategies and set
> them into the camelContext.
>
> You can find the code in the afterPropertiesSet() method of
> AbstractCamelContextFactoryBean[1].
>
> [1]https://svn.apache.org/repos/asf/camel/trunk/components/camel-core-xml/sr
> c/main/java/org/apache/camel/core/xml/AbstractCamelContextFactoryBean.java
>
> On 10/22/10 12:15 PM, ext2 wrote:
>> Hi:
>>       Camel's Context support a low level
>> API(CamelContext.addInterceptStrategy), which we could use it to add our
>> custom interceptor-strategy in Java  DSL program;
>>       But while using Spring DSL, it seems there is no such a
>> configuration we can use to configure the custom interceptor-strategy;
>>       How about to add such a support?
>>
>>       It may looks like as following:
>>       <beans>
>>               <bean id="interceptorStrategyList"
>> class="org.apache.camel.InterceptorStrategyList ">
>>               <camel:context>
>>                       ...
>>               </camel:context>
>>       </beans>
>>       The bean "interceptorStrategyList" support a method to return a list
>> of custom interceptor strategy; And camel-spring could find the bean and
>> register the interceptors into camelContext;
>>
>> Thanks any suggestion
>>
>>
>>
>
>
> --
> Willem
> ----------------------------------
> Open Source Integration: http://www.fusesource.com
> Blog:    http://willemjiang.blogspot.com (English)
>          http://jnn.javaeye.com (Chinese)
> Twitter: http://twitter.com/willemjiang
>
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

: Could camel support configurable interceptor strategy in spring?

Posted by ext2 <xu...@tongtech.com>.
Thanks a lot. I see;

Camel could look up all the configured interceptor-strategies in spring
application context. But unfortunately, it seems we couldn't control the
wrap order of interceptor-strategies; 

============================================================================
On 2010/10/22 12:29 Willem Jiang Wrote
 Re: Could camel support configurable interceptor strategy in spring?

You can just add the InterceptorStrategies into the application, 
CamelContextFactoryBean will pick up these interceptorStrategies and set 
them into the camelContext.

You can find the code in the afterPropertiesSet() method of 
AbstractCamelContextFactoryBean[1].

[1]https://svn.apache.org/repos/asf/camel/trunk/components/camel-core-xml/sr
c/main/java/org/apache/camel/core/xml/AbstractCamelContextFactoryBean.java

On 10/22/10 12:15 PM, ext2 wrote:
> Hi:
> 	Camel's Context support a low level
> API(CamelContext.addInterceptStrategy), which we could use it to add our
> custom interceptor-strategy in Java  DSL program;
> 	But while using Spring DSL, it seems there is no such a
> configuration we can use to configure the custom interceptor-strategy;
> 	How about to add such a support?
>
> 	It may looks like as following:
> 	<beans>
> 		<bean id="interceptorStrategyList"
> class="org.apache.camel.InterceptorStrategyList ">
> 		<camel:context>
> 			...
> 		</camel:context>
> 	</beans>
> 	The bean "interceptorStrategyList" support a method to return a list
> of custom interceptor strategy; And camel-spring could find the bean and
> register the interceptors into camelContext;
>
> Thanks any suggestion	
>
>
>


-- 
Willem
----------------------------------
Open Source Integration: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: http://twitter.com/willemjiang



Re: Could camel support configurable interceptor strategy in spring?

Posted by Willem Jiang <wi...@gmail.com>.
You can just add the InterceptorStrategies into the application, 
CamelContextFactoryBean will pick up these interceptorStrategies and set 
them into the camelContext.

You can find the code in the afterPropertiesSet() method of 
AbstractCamelContextFactoryBean[1].

[1]https://svn.apache.org/repos/asf/camel/trunk/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelContextFactoryBean.java

On 10/22/10 12:15 PM, ext2 wrote:
> Hi:
> 	Camel's Context support a low level
> API(CamelContext.addInterceptStrategy), which we could use it to add our
> custom interceptor-strategy in Java  DSL program;
> 	But while using Spring DSL, it seems there is no such a
> configuration we can use to configure the custom interceptor-strategy;
> 	How about to add such a support?
>
> 	It may looks like as following:
> 	<beans>
> 		<bean id="interceptorStrategyList"
> class="org.apache.camel.InterceptorStrategyList ">
> 		<camel:context>
> 			...
> 		</camel:context>
> 	</beans>
> 	The bean "interceptorStrategyList" support a method to return a list
> of custom interceptor strategy; And camel-spring could find the bean and
> register the interceptors into camelContext;
>
> Thanks any suggestion	
>
>
>


-- 
Willem
----------------------------------
Open Source Integration: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: http://twitter.com/willemjiang

Re: Could camel support configurable interceptor strategy in spring?

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

See this page
http://camel.apache.org/advanced-configuration-of-camelcontext-using-spring.html

On Fri, Oct 22, 2010 at 6:15 AM, ext2 <xu...@tongtech.com> wrote:
> Hi:
>        Camel's Context support a low level
> API(CamelContext.addInterceptStrategy), which we could use it to add our
> custom interceptor-strategy in Java  DSL program;
>        But while using Spring DSL, it seems there is no such a
> configuration we can use to configure the custom interceptor-strategy;
>        How about to add such a support?
>
>        It may looks like as following:
>        <beans>
>                <bean id="interceptorStrategyList"
> class="org.apache.camel.InterceptorStrategyList ">
>                <camel:context>
>                        ...
>                </camel:context>
>        </beans>
>        The bean "interceptorStrategyList" support a method to return a list
> of custom interceptor strategy; And camel-spring could find the bean and
> register the interceptors into camelContext;
>
> Thanks any suggestion
>
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Could camel support configurable interceptor strategy in spring?

Posted by ext2 <xu...@tongtech.com>.
Hi:
	Camel's Context support a low level
API(CamelContext.addInterceptStrategy), which we could use it to add our
custom interceptor-strategy in Java  DSL program;
	But while using Spring DSL, it seems there is no such a
configuration we can use to configure the custom interceptor-strategy;
	How about to add such a support?

	It may looks like as following:
	<beans>
		<bean id="interceptorStrategyList"
class="org.apache.camel.InterceptorStrategyList ">
		<camel:context>
			...
		</camel:context>
	</beans>
	The bean "interceptorStrategyList" support a method to return a list
of custom interceptor strategy; And camel-spring could find the bean and
register the interceptors into camelContext;

Thanks any suggestion	



Re: how to implement the instrumentation of from-endpoint?(Should camel to support the route level interceptor)

Posted by Claus Ibsen <cl...@gmail.com>.
See also
http://camel.apache.org/eventnotifier-to-log-details-about-all-sent-exchanges.html


On Fri, Oct 22, 2010 at 6:01 AM, ext2 <xu...@tongtech.com> wrote:
>
>
> Hi:
>        Camel support interceptors for processor, but recently I encounter a
> requirement, it ask for a custom instrumentation strategy of from endpoint;
> for example , we need the statistics of how much times the message is
> successfully processed in a given time, and how much message is failed;
>
>        I think we could have three choice to achieve such purpose.
>        1) Do instrument things, in the from-endpoint.
>                it's bad, because it need to change the code of camel's
> consumer
>
>        2) Extend a policy processor to wrapper the whole route, and do
> measurement
>                It seems the solution is too heavy. But the solution does
> works, and now I am using this solution in my work;
>
>        3) Support a route level interceptor (just like the processor's
> interceptor, but it will wrapper the whole route).
>        It seems the solution is more lightweight than the policy-processor.
> How about to add such the support in camel?
>
> Thanks any suggestion
>
>
>
>
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus