cxf server basic authentication (using interceptor) does not protect wsdl browsing
Thanks to Chris Dail, we have been using his BasicAuthAuthorizationInterceptor to enforce basic authentication on a Camel CXF consumer endpoint (server), say, http://www.acme.com/test.svc. We noticed that the enforcement does not apply to the WSDL browsing (http://www.acme.com/test.svc?wsdl). That is, anybody can browse the wsdl without being authenticated. In fact, the interceptor does not even get called for such wsdl browsing. So my question is that whether there is a way to enforce basic authentication for all such accesses through camel-cxf. Thanks in advance for any insight! -- View this message in context: http://camel.465427.n5.nabble.com/cxf-server-basic-authentication-using-interceptor-does-not-protect-wsdl-browsing-tp5777614.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to setup WSS4j interceptor for cxfbean component?
There is an example in chapter 14 of the Camel in Action 2nd ed book Though you can maybe also find an example but looking at the unit tests of camel-cxf. And you are welcome to help improve the docs. http://camel.apache.org/contributing On Thu, Jan 28, 2016 at 7:35 PM, Harry Hwu <ralug...@gmail.com> wrote: > Hi All, > > I have a question about configure a cxfbean component ( > http://camel.apache.org/cxf-bean-component.html) to use a WSS4j > interceptor. For CXF endpoint, there's documented step available but > somehow I couldn't find any for cxfbean.(http://camel.apache.org/cxf.html) > > Any help or insight on this is greatly appreciated! > > Thanks, > > Harry Hwu -- Claus Ibsen - http://davsclaus.com @davsclaus Camel in Action 2: https://www.manning.com/ibsen2
How to setup WSS4j interceptor for cxfbean component?
Hi All, I have a question about configure a cxfbean component ( http://camel.apache.org/cxf-bean-component.html) to use a WSS4j interceptor. For CXF endpoint, there's documented step available but somehow I couldn't find any for cxfbean.(http://camel.apache.org/cxf.html) Any help or insight on this is greatly appreciated! Thanks, Harry Hwu
Interceptor into external file
Hello, i would use same interceptor (XML Spring implementation) into my different projects. Can i reference an interceptor like "routeContextRef" tag or "restContextRef" tag? -- View this message in context: http://camel.465427.n5.nabble.com/Interceptor-into-external-file-tp5771400.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Interceptor into external file
If you are using OSGi you can leverage OSGi Service Listeners to programmatically add the interceptors whenever a new context appears in the environment. *Raúl Kripalani* Apache Camel PMC Member & Committer | Enterprise Architect, Open Source Integration specialist http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani http://blog.raulkr.net | twitter: @raulvk On Thu, Sep 10, 2015 at 11:57 AM, fabrizio.spataro < fabrizio.spat...@bizmate.it> wrote: > Hello, > > i would use same interceptor (XML Spring implementation) into my different > projects. > > Can i reference an interceptor like "routeContextRef" tag or > "restContextRef" tag? > > > > > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Interceptor-into-external-file-tp5771400.html > Sent from the Camel - Users mailing list archive at Nabble.com. >
Re: Interceptor into external file
Hi, What kind of interceptor do you have in mind? Spring AOP one or Camel one? Cheers! czw., 10.09.2015 o 12:57 użytkownik fabrizio.spataro < fabrizio.spat...@bizmate.it> napisał: > Hello, > > i would use same interceptor (XML Spring implementation) into my different > projects. > > Can i reference an interceptor like "routeContextRef" tag or > "restContextRef" tag? > > > > > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Interceptor-into-external-file-tp5771400.html > Sent from the Camel - Users mailing list archive at Nabble.com. > -- Henryk Konsek http://about.me/hekonsek
Re: Interceptor into external file
I don't think it is possible in Spring XML DSL. However it is definitely possible with Java DSL. Maybe you can switch to Java? Java DSL is really flexible :) . Cheers! czw., 10.09.2015 o 14:28 użytkownik fabrizio.spataro < fabrizio.spat...@bizmate.it> napisał: > Camel interceptor: > > http://camel.apache.org/schema/spring; > errorHandlerRef="deadLetterErrorHandler"> > ... ANOTHER CODE .. > ... ANOTHER CODE .. > ... ANOTHER CODE .. > > > ... MY CODE .. > ... MY CODE .. > ... MY CODE .. > ... MY CODE .. > > > ... ANOTHER CODE .. > ... ANOTHER CODE .. > ... ANOTHER CODE .. > > > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Interceptor-into-external-file-tp5771400p5771403.html > Sent from the Camel - Users mailing list archive at Nabble.com. > -- Henryk Konsek http://about.me/hekonsek
Re: Interceptor into external file
Camel interceptor: http://camel.apache.org/schema/spring; errorHandlerRef="deadLetterErrorHandler"> ... ANOTHER CODE .. ... ANOTHER CODE .. ... ANOTHER CODE .. ... MY CODE .. ... MY CODE .. ... MY CODE .. ... MY CODE .. ... ANOTHER CODE .. ... ANOTHER CODE .. ... ANOTHER CODE .. -- View this message in context: http://camel.465427.n5.nabble.com/Interceptor-into-external-file-tp5771400p5771403.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Interceptor into external file
Ok thanks, my (temporary?) implementation is: FILE 1: ... MY CODE .. ... MY CODE .. ... MY CODE .. ... MY CODE .. MAIN FILE: http://camel.apache.org/schema/spring; errorHandlerRef="deadLetterErrorHandler"> ** ... ANOTHER CODE .. ... ANOTHER CODE .. ... ANOTHER CODE .. ... ANOTHER CODE .. ... ANOTHER CODE .. -- View this message in context: http://camel.465427.n5.nabble.com/Interceptor-into-external-file-tp5771400p5771410.html Sent from the Camel - Users mailing list archive at Nabble.com.
camel-cxf: Accessing Camel headers/properties in CXF interceptor on exception
Hi, I have a CXF endpoint with a CXF interceptor that inspects properties from the Camel exchange in order to do its job. In the good case everything works fine: The properties/headers get set somewhere in the Camel route, and when the route finishes, the CxfBinding propagates them to the CxfExchange where the interceptor can find them. If, however, the route is short-circuited by an exception, the propagation step from Camel exchange to CXF exchange seems to be skipped, and the information is not available to my interceptor. Any ideas on how to get that scenario to work without handling the exception in Camel? Thanks, Jens -- View this message in context: http://camel.465427.n5.nabble.com/camel-cxf-Accessing-Camel-headers-properties-in-CXF-interceptor-on-exception-tp5770530.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Simple interceptor code not working
Hi Claus, Thanks a lot for that link. Regards, Shreyas -- View this message in context: http://camel.465427.n5.nabble.com/Simple-interceptor-code-not-working-tp5750577p5750630.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Simple interceptor code not working
Thanks for the reply. Other than testing, where else is this useful in real life scenario, esp since it has to be in the same RouteBuilder? I was thinking of using this concept externally to modify existing route. Any idea how I can achieve that if not for interceptors? Thanks, Shreyas -- View this message in context: http://camel.465427.n5.nabble.com/Simple-interceptor-code-not-working-tp5750577p5750615.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Simple interceptor code not working
Hi A Camel user wrote a blog about his experience with advice with. Its worth to take a look http://www.opensourceconnections.com/2014/04/24/correctly-using-camels-advicewith-in-unit-tests/ On Fri, Apr 25, 2014 at 4:24 PM, shreyaspurohit shreyas.puro...@hotmail.com wrote: Thanks for the reply. Other than testing, where else is this useful in real life scenario, esp since it has to be in the same RouteBuilder? I was thinking of using this concept externally to modify existing route. Any idea how I can achieve that if not for interceptors? Thanks, Shreyas -- View this message in context: http://camel.465427.n5.nabble.com/Simple-interceptor-code-not-working-tp5750577p5750615.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen hawtio: http://hawt.io/ fabric8: http://fabric8.io/
Re: Simple interceptor code not working
The interceptor must be in the same RouteBuilder. On Fri, Apr 25, 2014 at 4:12 AM, shreyas shreyas.puro...@hotmail.com wrote: Hello, I have modified the camel console example to use interceptor. The interceptor is not working when I put the code that uses interceptSendToEndpoint in InterceptorRoute.configure method, but works when I put the same in TestInterceptorBuilder.configure method. I am not sure why this does not work and how to make it work such that the interceptSendToEndpoint is outside the RouteBuilder that builds the real route. The code is very small hence I have put the snippets here. If it is difficult to read I apologize. I have also attached the project zip. My camel context has: bean id=interceptorRouteBuilder class=routes.TestInterceptorBuilder / bean id=interceptorRoute class=routes.InterceptorRoute/ camelContext xmlns=http://camel.apache.org/schema/spring; routeBuilder ref=interceptorRouteBuilder / routeBuilder ref=interceptorRoute / /camelContext The TestInterceptorBuilder class has the below code: public class TestInterceptorBuilder extends RouteBuilder { @Override public void configure() throws Exception { from(stream:in?promptMessage=Enter something: ) .to(mock:bar) .to(mock:foo) .to(mock:result) .to(stream:out); } } The InterceptorRoute has the below code: public class InterceptorRoute extends RouteBuilder { @Override public void configure() throws Exception { interceptSendToEndpoint(mock:foo) .to(mock:detour).transform(constant(Bye World)); } } Thanks a lot of any help or pointers to solve this problem. -Shreyas Purohit -- Claus Ibsen - Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen hawtio: http://hawt.io/ fabric8: http://fabric8.io/
Re: Camel receipient list with interceptor
Hi Maybe take a look at interceptors http://camel.apache.org/intercept On Wed, Mar 20, 2013 at 1:28 AM, santhosh ramukhsohtna...@gmail.com wrote: My architecture needs to multicast to multiple endpoints which will be constructed dynamically and before the message is sent to end point it needs to be customized.Now its like multicast parallelProcessing=true streaming=true id=staticrecipient strategyRef=StringAggregationStrategy timeout=2500 onPrepareRef=StringDeepClonePrepare to uri=direct:A / to uri=direct:B / /multicast route id=AClient from uri=direct:A / camel:setHeader headerName=A!- some endpoint specific manipulation similar to this-- camel:constant Sending to A/camel:constant !- some endpoint specific manipulation similar to this-- /camel:setHeader to uri=http://A.com;/to /route Now we are moving away from static recipient list list to dynamic recipient list recipientList parallelProcessing=true streaming=true id=dyanmicrecipient strategyRef=StringAggregationStrategy timeout=3000 onPrepareRef=StringDeepClonePrepare what should come here for spring DSL.cant find it in doc.I can use Header based receipient list but just asking *method(MessageRouter.class, quot;routeToquot;)* /recipientList The method routeTo will return url like A.com,B.com(left out http protocal due to hyperlink issues) ... depending upon incoming message.i am assuming camel-http will automatically take care of endpoint creation.correct me if i am wrong. Everything is same as previous but except i am trying to do everything within multicast /recipientList list without defining additional routes because i dont know the routes during compile time. 1)Can i use onPrep processor in some way.cant think of it because i dont know which exchange is used for which endpoint.If i know endpointin exchange properties , then i think i can manipulate it very high level of something what i think public class OnPrepare implements Processor { public void process(Exchange exchange) throws Exception { //i know this function doesnt exist String toURI=exchange.getTOUri() //then perform endpoint based manipulation of message } } Can opPrep be used for this.is it only for things like clone. 2)Can i use intercept only for receipient list only. Problems: 1)i dont want to use intercept for whole route and filter based on predicate. 2)I cant use interceptToSendEndpoint because i dont know endpoint at compile time. 3)In short,i want to intercept the message. In multicast ,say if its sent to Endpoint A then add header A in intercept bean.In multicast ,say if its sent to Endpoint B then add header B in intercept bean.Noting Endpoint A and Endpoint B will be constructed dynamically and will be in multicast as probably receipient list. Can this be done. 3)Whats the best way of doing it.I dont want to move away from Spring DSL.I know i can mix spring DSL and java DSL.DO you guys think i should dynamically construct routes/Endpoints using java DSL and invoke them in multicast/recipientList in spring DSL.Rewrite Entire code in java DSL is the last option. Thanks for reading such a long post.Much appreciated.Please let me know if its confusing. It would be nice if you can answer all three or whichever you know. -- View this message in context: http://camel.465427.n5.nabble.com/Camel-receipient-list-with-interceptor-tp5729462.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - Red Hat, Inc. FuseSource is now part of Red Hat Email: cib...@redhat.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
Re: Camel receipient list with interceptor
I have read through it and i couldnt figure anything out for reasons i mentioned in previous post.Rephrasing my questions short 1)Is there a property in exchange which says the which endpoint the message is intended for??Can i use it in multicast for identifying the endpoint for which exchange will be used. 2)Is there a way to intercept message to dynamic endpoint.Endpoint that will be available only in runtime. -- View this message in context: http://camel.465427.n5.nabble.com/Camel-receipient-list-with-interceptor-tp5729462p5729549.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel receipient list with interceptor
I will answer this question myself .You can find the endpoint which the exchange is used by using exchange.getProperty(CamelToEndpoint) . To answer the overall question - how to manipulate the message in recipient/multicast according to endpoint keeping in mind the endpoint list will be created dynamically at runtime.What it means is we would know which endpoints the message needs to be mulitcasted only at runtime and before it gets sent we need to perform endpoint specific message manipulation. recipientList parallelProcessing=true streaming=true id=recipientList strategyRef=StringAggregationStrategy timeout=2500 onPrepareRef=CustomExchangeMessage delimiter=, ignoreInvalidEndpoints=true headerendpointList/header /recipientList The below class is just an idea out of my mind.in real use case the recipient list will be populated dynamically and the exchange body manipulation will be dynamic.I dont know if this is the recommended way but i think it will work .Please let me know if see any obvious problems public class CustomExchangeMessage implements Processor { public void process(Exchange exchange) throws Exception { String body = exchange.getIn().getBody(String.class); String toEndpoint=exchange.getProperty(CamelToEndpoint); //this is a simple if now .but this will be where the dynamic part willl kick in. if(toEndpoint.equalsIgnoreCase(A)) { //manipulate the body for endpoint A } if(toEndpoint.equalsIgnoreCase(B)) { //manipulate the body for endpoint B } } } This question has been answered and can be closed. -- View this message in context: http://camel.465427.n5.nabble.com/Camel-receipient-list-with-interceptor-tp5729462p5729568.html Sent from the Camel - Users mailing list archive at Nabble.com.
Camel receipient list with interceptor
My architecture needs to multicast to multiple endpoints which will be constructed dynamically and before the message is sent to end point it needs to be customized.Now its like multicast parallelProcessing=true streaming=true id=staticrecipient strategyRef=StringAggregationStrategy timeout=2500 onPrepareRef=StringDeepClonePrepare to uri=direct:A / to uri=direct:B / /multicast route id=AClient from uri=direct:A / camel:setHeader headerName=A!- some endpoint specific manipulation similar to this-- camel:constant Sending to A/camel:constant !- some endpoint specific manipulation similar to this-- /camel:setHeader to uri=http://A.com;/to /route Now we are moving away from static recipient list list to dynamic recipient list recipientList parallelProcessing=true streaming=true id=dyanmicrecipient strategyRef=StringAggregationStrategy timeout=3000 onPrepareRef=StringDeepClonePrepare what should come here for spring DSL.cant find it in doc.I can use Header based receipient list but just asking *method(MessageRouter.class, quot;routeToquot;)* /recipientList The method routeTo will return url like A.com,B.com(left out http protocal due to hyperlink issues) ... depending upon incoming message.i am assuming camel-http will automatically take care of endpoint creation.correct me if i am wrong. Everything is same as previous but except i am trying to do everything within multicast /recipientList list without defining additional routes because i dont know the routes during compile time. 1)Can i use onPrep processor in some way.cant think of it because i dont know which exchange is used for which endpoint.If i know endpointin exchange properties , then i think i can manipulate it very high level of something what i think public class OnPrepare implements Processor { public void process(Exchange exchange) throws Exception { //i know this function doesnt exist String toURI=exchange.getTOUri() //then perform endpoint based manipulation of message } } Can opPrep be used for this.is it only for things like clone. 2)Can i use intercept only for receipient list only. Problems: 1)i dont want to use intercept for whole route and filter based on predicate. 2)I cant use interceptToSendEndpoint because i dont know endpoint at compile time. 3)In short,i want to intercept the message. In multicast ,say if its sent to Endpoint A then add header A in intercept bean.In multicast ,say if its sent to Endpoint B then add header B in intercept bean.Noting Endpoint A and Endpoint B will be constructed dynamically and will be in multicast as probably receipient list. Can this be done. 3)Whats the best way of doing it.I dont want to move away from Spring DSL.I know i can mix spring DSL and java DSL.DO you guys think i should dynamically construct routes/Endpoints using java DSL and invoke them in multicast/recipientList in spring DSL.Rewrite Entire code in java DSL is the last option. Thanks for reading such a long post.Much appreciated.Please let me know if its confusing. It would be nice if you can answer all three or whichever you know. -- View this message in context: http://camel.465427.n5.nabble.com/Camel-receipient-list-with-interceptor-tp5729462.html Sent from the Camel - Users mailing list archive at Nabble.com.
Global Interceptor for all incoming Messages
Hello, I want to know how to add a Global 'interceptFrom()' like construct for all routes in a Camel Context. I have say 4 - 5 independent Route Builders defined using the Java DSL which I am adding to a Camel Context defined in Spring through the routebuilder ref=/ declaration. Now I want to include a single interceptFrom [Also defined as part of a common RouteBuilder using Java] which would intercept all messages coming on all routes defined in all the route builders which reside in the context Unfortunately, the interceptFrom() only seems to intercept messages for those routes which are defined in the same RouteBuilder class as the interceptFrom() itself. Is there a way to intercept messages for all incoming messages for all routes that the camel context holds? Regards, Sushil -- View this message in context: http://camel.465427.n5.nabble.com/Global-Interceptor-for-all-incoming-Messages-tp5714820.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Global Interceptor for all incoming Messages
On Thu, Jun 21, 2012 at 10:47 AM, sushil_vsk5 sushil_v...@yahoo.co.in wrote: Hello, I want to know how to add a Global 'interceptFrom()' like construct for all routes in a Camel Context. I have say 4 - 5 independent Route Builders defined using the Java DSL which I am adding to a Camel Context defined in Spring through the routebuilder ref=/ declaration. Now I want to include a single interceptFrom [Also defined as part of a common RouteBuilder using Java] which would intercept all messages coming on all routes defined in all the route builders which reside in the context Unfortunately, the interceptFrom() only seems to intercept messages for those routes which are defined in the same RouteBuilder class as the interceptFrom() itself. Is there a way to intercept messages for all incoming messages for all routes that the camel context holds? Regards, Sushil You can have a base RouteBuilder class (extending the Camel RouteBuilder) where you add the global stuff. And then extend this class from your routes, and invoke the super. configure() method first, so the base class code is included. -- View this message in context: http://camel.465427.n5.nabble.com/Global-Interceptor-for-all-incoming-Messages-tp5714820.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
Re: Global Interceptor for all incoming Messages
Hello Claus, Thanks a lot for the quick reply. I can very well do that in case I am the one who is writing all the Routes. But that is not the case. Actually, people who will be writing the routes can belong to different teams and I really do not have much control over what they are putting into their routes and which classes they extend. But I want to have the ability to inject some cross-cutting concerns before the routes are getting called in a generic fashion (I would be the one who will have control on what goes into the Camel Context as well). So, without the constraint of having all developers extending from a custom RouteBuilder class, is there any other way I can achieve this? Can I use an IntercepyStrategy or something? Regards, Sushil -- View this message in context: http://camel.465427.n5.nabble.com/Global-Interceptor-for-all-incoming-Messages-tp5714820p5714827.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Global Interceptor for all incoming Messages
H. Cross-cutting concerns. Sounds like a job for AspectJ? On Thu, Jun 21, 2012 at 6:00 AM, sushil_vsk5 sushil_v...@yahoo.co.in wrote: Hello Claus, Thanks a lot for the quick reply. I can very well do that in case I am the one who is writing all the Routes. But that is not the case. Actually, people who will be writing the routes can belong to different teams and I really do not have much control over what they are putting into their routes and which classes they extend. But I want to have the ability to inject some cross-cutting concerns before the routes are getting called in a generic fashion (I would be the one who will have control on what goes into the Camel Context as well). So, without the constraint of having all developers extending from a custom RouteBuilder class, is there any other way I can achieve this? Can I use an IntercepyStrategy or something? Regards, Sushil -- View this message in context: http://camel.465427.n5.nabble.com/Global-Interceptor-for-all-incoming-Messages-tp5714820p5714827.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Global Interceptor for all incoming Messages
On Thu, Jun 21, 2012 at 12:00 PM, sushil_vsk5 sushil_v...@yahoo.co.in wrote: Hello Claus, Thanks a lot for the quick reply. I can very well do that in case I am the one who is writing all the Routes. But that is not the case. Actually, people who will be writing the routes can belong to different teams and I really do not have much control over what they are putting into their routes and which classes they extend. But I want to have the ability to inject some cross-cutting concerns before the routes are getting called in a generic fashion (I would be the one who will have control on what goes into the Camel Context as well). So, without the constraint of having all developers extending from a custom RouteBuilder class, is there any other way I can achieve this? Can I use an IntercepyStrategy or something? Its on the roadmap for Camel 3.0 to allow to hot deploy / instrument cross cutting concerns to existing CamelContext's on the fly. In the 2.x version you need to do this up-front. Regards, Sushil -- View this message in context: http://camel.465427.n5.nabble.com/Global-Interceptor-for-all-incoming-Messages-tp5714820p5714827.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
Re: Global Interceptor for all incoming Messages
2012/6/21 sushil_vsk5 sushil_v...@yahoo.co.in: Unfortunately, the interceptFrom() only seems to intercept messages for those routes which are defined in the same RouteBuilder class as the interceptFrom() itself. Is there a way to intercept messages for all incoming messages for all routes that the camel context holds? We used a custom route policy applied to a list of specific routes, which runs the same set of checks on those routes, at the start of the route. Or something else: http://java.dzone.com/articles/aspect-oriented-programming-camel Maybe that could help you? Tung
Re: add interceptor to a camel context
Hi You need to add the interceptors to the RoutesDefinition On Tue, Jun 12, 2012 at 11:33 AM, fradj zayen zaye...@gmail.com wrote: Hi all, I'd like to add interceptors to camel context programatically. below some code snippet Camel Context definition: CamelContext camelContext=new DefaultCamelContext(); RouteDefinition routeDefinition=new RouteDefinition(); routeDefinition.from(direct:a).to(direct:b).to(direct:c); camelContext.getRouteDefinitions().add(routeDefinition); camelContext.setTracing(true); camelContext.start(); Interceptor to be used: InterceptSendToEndpointDefinition interceptor=new InterceptSendToEndpointDefinition( direct:b); interceptor.process(new Processor() { public void process(Exchange exchange) throws Exception { System.out.println(exchange); } }); interceptor.to(log:intercepted ${body}); interceptor.end(); I used the following configuration to add the interceptor to the camel context, but the interceptor is not fired when an exchange is sent to the intercepted endpoint ((ModelCamelContext) camelContext).getRouteDefinitions()..get(0).getOutputs().add( interceptor); Can someone help on this? thanks for your help -- Claus Ibsen - FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
Dynamically set WSS4J interceptor properties
Hello All, I am using Camel/CXF to implement WS-Security Requirements, specifically in this case Signature Encrypt and Timestamp. I used an example that Camel distributed as a starting point and manually configured the WSS4J interceptors. My issue is that my service will call maybe 10 or 20 services. I don't want to configure one Interceptor per service I am calling because the only thing that is different is the encryptionUser. This is the alias of the public key you are using to encrypt the message. Here is the WSS4J interceptor: bean id=wss4jOutInterceptor class=org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor constructor-arg map entry key=action value=Signature Encrypt Timestamp / entry key=user value=client-key / entry key=encryptionUser value=server-1-cert / entry key=passwordCallbackRef ref bean=passwordCallbackBean / /entry entry key=signatureKeyIdentifier value=DirectReference / entry key=signatureParts value={Element}{http://schemas.xmlsoap.org/soap/envelope/}Body; / entry key=passwordType value=PasswordDigest / /map /constructor-arg /bean Notice that encryptionUser would have to be different for all requests. I don't want to recreate this bean multiple times. I did figure out a workaround for the properties files for WSS4J. I use a bean to set the request context and inject the values: bean id=cryptoPropertiesMessageProcessor class=org.myPackage.CryptoPropertiesMessageProcessor property name=cryptoProvider value=org.apache.ws.security.components.crypto.Merlin/ property name=keystoreType value=jks/ property name=signingKeystore value=client.jks/ property name=signingKeystorePassword value=password/ property name=signingKeystoreAlias value=client-key/ property name=encryptionKeystore value=serverTrustore.ts/ property name=encryptionKeystorePassword value=password/ property name=encryptionKeystoreAlias map entry key=endpoint1 value=server-1-cert / entry key=endpoint2 value=server-2-cert / /map /property /bean I set the key to the map as a Camel Header that I set in the route and then I can retrieve the alias. See this simple bean: public void addCryptoProperties(Exchange exchange) throws Exception { MapString, Object requestContext = new HashMapString, Object(); Properties cryptoPropertiesSignature = new Properties(); cryptoPropertiesSignature.put(org.apache.ws.security.crypto.provider,cryptoProvider); cryptoPropertiesSignature.put(org.apache.ws.security.crypto.merlin.keystore.password, signingKeystorePassword); cryptoPropertiesSignature.put(org.apache.ws.security.crypto.merlin.file,signingKeystore); cryptoPropertiesSignature.put(org.apache.ws.security.crypto.merlin.keystore.type, keystoreType); cryptoPropertiesSignature.put(org.apache.ws.security.crypto.merlin.keystore.alias, signingKeystoreAlias); requestContext.put(cryptoPropertiesSignature, cryptoPropertiesSignature); /** IMPORTANT, the below configuration will only work with WSS4J 1.6, you need to use 'SignaturePropRefId' for 1.5 **/ requestContext.put(signaturePropRefId,cryptoPropertiesSignature); Properties cryptoPropertiesEncryption = new Properties(); cryptoPropertiesEncryption.put(org.apache.ws.security.crypto.provider,cryptoProvider); cryptoPropertiesEncryption.put(org.apache.ws.security.crypto.merlin.keystore.password, encryptionKeystorePassword); cryptoPropertiesEncryption.put(org.apache.ws.security.crypto.merlin.file,encryptionKeystore); cryptoPropertiesEncryption.put(org.apache.ws.security.crypto.merlin.keystore.type, keystoreType); String encryptionAliasEndpoint = (String)exchange.getIn().getHeader(endpointEncryptionAlias); String encryptionAlias = null; if (StringUtils.isNotBlank(encryptionAliasEndpoint)) { encryptionAlias = encryptionKeystoreAlias.get(encryptionAliasEndpoint); } else { throw new Exception(Camel Header endpointEncryptionAlias is not set); } cryptoPropertiesEncryption.put(org.apache.ws.security.crypto.merlin.keystore.alias, encryptionAlias); requestContext.put(cryptoPropertiesEncryption
Re: Dynamically set WSS4J interceptor properties
Another idea here is to set the scope to 'request' on the WSS4J interceptor and override a method to set the encryption user. Has anyone done that before similar to this: http://forum.springsource.org/showthread.php?81311-Configuring-WSS4J-Encrypt-for-multiple-clients-how Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Dynamically-set-WSS4J-interceptor-properties-tp5551391p5551678.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: CxfEndpoint and configure interceptor on bus
Hi Aki, Thanks for your reply. The problem was that the interceptor that was defined on the bus was not invoked and even not added to the interceptor chain but this was a stupid configuration error on my side :-( With CXF-2.4.4 it was working if cxfcore:bus id=somebus ... was defined (wrong usage of the id attribute instead of bus) and with CXF-2.4.6 (or newer) this does no longer work. Switching to CXF-2.5.2 threw an exception that no bus with this id/name was configured and this lead me to find the wrong configuration. Sorry for the noise on the camel list because it's a CXF related issue caused by my wrong configuration. Regards, Andi -- View this message in context: http://camel.465427.n5.nabble.com/CxfEndpoint-and-configure-interceptor-on-bus-tp5541585p5543569.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: CxfEndpoint and configure interceptor on bus
Hi Andi, There have been some changes in the wiring between the camel-cxf endpoints and cxf buses recently. Therefore, there may be some combination of the cxf and camel versions that could lead to some issues depending on how they are wired. That's why I was asking for the camel version and if you could try for camel 2.9.0. But as I said before, it's normal when you don't find the other interceptor when you look into the endpoint, but it is a bug or some kind of incompatibility issue when one of the interceptors is not invoked or some exception is thrown during the invocation. thanks. regards, aki 2012/3/7 akuhtz andreas.ku...@gmail.com: Hi Aki, Thanks for your reply. The problem was that the interceptor that was defined on the bus was not invoked and even not added to the interceptor chain but this was a stupid configuration error on my side :-( With CXF-2.4.4 it was working if cxfcore:bus id=somebus ... was defined (wrong usage of the id attribute instead of bus) and with CXF-2.4.6 (or newer) this does no longer work. Switching to CXF-2.5.2 threw an exception that no bus with this id/name was configured and this lead me to find the wrong configuration. Sorry for the noise on the camel list because it's a CXF related issue caused by my wrong configuration. Regards, Andi -- View this message in context: http://camel.465427.n5.nabble.com/CxfEndpoint-and-configure-interceptor-on-bus-tp5541585p5543569.html Sent from the Camel - Users mailing list archive at Nabble.com.
CxfEndpoint and configure interceptor on bus
Hi, I've a question regarding camel-cxf in combination with interceptors configured on the CXF-bus. It seems that the behaviour has changed from CXF-version 2.4.4 to 2.4.6 but I'm not sure if it's a camel problem. I've modified a unit-test that shows the problem. I expected an interceptor that is configured on the cxf-bus to be added to any cxf-endpoint that uses this bus but it's not added. Please see the attached patch that has the modified test. http://camel.465427.n5.nabble.com/file/n5541585/camel-cxf-question.patch camel-cxf-question.patch Is my assumption wrong? Best regards Andi -- View this message in context: http://camel.465427.n5.nabble.com/CxfEndpoint-and-configure-interceptor-on-bus-tp5541585p5541585.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: CxfEndpoint and configure interceptor on bus
Hi Andi, I think you always saw at the endpoint only the interceptors that are configured at the endpoint. But you saw both interceptors when the interceptor chain is built. Are you not seeing both interceptors when the interceptor chain is invoked? If you have this problem, can you tell us which camel version are you using? And can you test it with Camel 2.9.0? regards, aki 2012/3/6 akuhtz andreas.ku...@gmail.com: Hi, I've a question regarding camel-cxf in combination with interceptors configured on the CXF-bus. It seems that the behaviour has changed from CXF-version 2.4.4 to 2.4.6 but I'm not sure if it's a camel problem. I've modified a unit-test that shows the problem. I expected an interceptor that is configured on the cxf-bus to be added to any cxf-endpoint that uses this bus but it's not added. Please see the attached patch that has the modified test. http://camel.465427.n5.nabble.com/file/n5541585/camel-cxf-question.patch camel-cxf-question.patch Is my assumption wrong? Best regards Andi -- View this message in context: http://camel.465427.n5.nabble.com/CxfEndpoint-and-configure-interceptor-on-bus-tp5541585p5541585.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Is there any way for a CXF interceptor to access the Camel Exchange?
Current CXF know nothing about the CXF. If you want to put the Camel Exchange into the CXF invocation-context, you may need to do some modification in the DefaultCxfBinding. On Fri Jul 8 13:50:39 2011, Jim Talbut wrote: Hi, I want to log the on the wire data seen by CXF, which I can do with a CXF interceptor, but I want to be able to correlate that log with the state of the Camel Exchange at that point. What I really want is a cross between a CXF interceptor and a Camel TraceEventHandler, but that's not possible (because the TraceEventHandler never gets to see the on the wire representation). So is there any way for a CXF interceptor to access the Camel Exchange? I was a bit surprised to find that it isn't recorded in the CXF INVOCATION_CONTEXT, but it isn't. For inbound requests I could add a header in the CXF interceptor that Camel can pick up, but for outbound requests I'd need to do that automatically (I don't want to have to manually add an extra processor before every CXF node in the route). Thanks Jim -- Willem -- FuseSource Web: http://www.fusesource.com Blog:http://willemjiang.blogspot.com (English) http://jnn.javaeye.com (Chinese) Twitter: willemjiang Weibo: willemjiang
Is there any way for a CXF interceptor to access the Camel Exchange?
Hi, I want to log the on the wire data seen by CXF, which I can do with a CXF interceptor, but I want to be able to correlate that log with the state of the Camel Exchange at that point. What I really want is a cross between a CXF interceptor and a Camel TraceEventHandler, but that's not possible (because the TraceEventHandler never gets to see the on the wire representation). So is there any way for a CXF interceptor to access the Camel Exchange? I was a bit surprised to find that it isn't recorded in the CXF INVOCATION_CONTEXT, but it isn't. For inbound requests I could add a header in the CXF interceptor that Camel can pick up, but for outbound requests I'd need to do that automatically (I don't want to have to manually add an extra processor before every CXF node in the route). Thanks Jim
Unexpected interceptor behavior
Hi all, I'm trying to test an onException handler of my route by intercepting a send on the main route and throwing an appropriate exception so that the onException handling is triggered. However, I ran into some unexpected behavior. A simplified testcase reproduces this behavior: http://pastebin.com/L5Wuuy4P I expect that the interceptSendToEndpoint on line 49 is triggered by the message that is sent on line 69 using a producer template. However, the interception is never performed, hence the exception is never thrown and the testcase fails with Success != Error. However, while experimenting a bit I found out that I could get the testcase to succeed by introducing a dummy direct endpoint in my main route, and intercepting that endpoint instead of the activemq endpoint: http://pastebin.com/PdK6gTNb (diff with previous failing testcase: http://pastebin.com/vdHghPB1 ) For me this was unexpected. How can I get my original testcase to succeed without altering my route? Thanks, Sander
Re: Unexpected interceptor behavior
Hi The webpage states that the Exchange has to be *on route* http://camel.apache.org/intercept Sending using producer template is not on route. On Mon, Jun 20, 2011 at 4:33 PM, Sander Mak sander...@gmail.com wrote: Hi all, I'm trying to test an onException handler of my route by intercepting a send on the main route and throwing an appropriate exception so that the onException handling is triggered. However, I ran into some unexpected behavior. A simplified testcase reproduces this behavior: http://pastebin.com/L5Wuuy4P I expect that the interceptSendToEndpoint on line 49 is triggered by the message that is sent on line 69 using a producer template. However, the interception is never performed, hence the exception is never thrown and the testcase fails with Success != Error. However, while experimenting a bit I found out that I could get the testcase to succeed by introducing a dummy direct endpoint in my main route, and intercepting that endpoint instead of the activemq endpoint: http://pastebin.com/PdK6gTNb (diff with previous failing testcase: http://pastebin.com/vdHghPB1 ) For me this was unexpected. How can I get my original testcase to succeed without altering my route? Thanks, Sander -- Claus Ibsen - FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
Re: Unexpected interceptor behavior
Ok, my intuition was that using the producer template the exchange would be put 'on route' (the activemq endpoint is the first endpoint on the route, right?). Apparently my intuition was wrong. However, that still leaves me with the question of how to achieve my goal without introducing an additional endpoint. Any pointers how I can alter the route behavior to test my onException route? Thanks! On Mon, Jun 20, 2011 at 7:22 PM, Claus Ibsen claus.ib...@gmail.com wrote: Hi The webpage states that the Exchange has to be *on route* http://camel.apache.org/intercept Sending using producer template is not on route. On Mon, Jun 20, 2011 at 4:33 PM, Sander Mak sander...@gmail.com wrote: Hi all, I'm trying to test an onException handler of my route by intercepting a send on the main route and throwing an appropriate exception so that the onException handling is triggered. However, I ran into some unexpected behavior. A simplified testcase reproduces this behavior: http://pastebin.com/L5Wuuy4P I expect that the interceptSendToEndpoint on line 49 is triggered by the message that is sent on line 69 using a producer template. However, the interception is never performed, hence the exception is never thrown and the testcase fails with Success != Error. However, while experimenting a bit I found out that I could get the testcase to succeed by introducing a dummy direct endpoint in my main route, and intercepting that endpoint instead of the activemq endpoint: http://pastebin.com/PdK6gTNb (diff with previous failing testcase: http://pastebin.com/vdHghPB1 ) For me this was unexpected. How can I get my original testcase to succeed without altering my route? Thanks, Sander -- Claus Ibsen - FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
error in interceptor: InputStreamCache cannot be cast to org.w3c.dom.Node
Hello all, I am implementing a monitor on my routes, using an interceptor. I am using Camel 2.3.0 inside Servicemix 3.3.2. The routes are working ok without the interceptor. In the monitor, I try to log the message, but it seems (not sure about this, just a guess) that that is causing the InputStream to be read and then It seems that it can not be read again. I am already using getContext().setStreamCaching(true); in my routes. Below, you can see the stack trace, any comments or help on this will be welcome. Thank you in advance. Javier Arias. [Fatal Error] :-1:-1: Premature end of file. [Fatal Error] :-1:-1: Premature end of file. [Fatal Error] :-1:-1: Premature end of file. [Fatal Error] :-1:-1: Premature end of file. [Fatal Error] :-1:-1: Premature end of file. 20110530-12:58:52.213 | ERROR | DefaultMessageListenerContainer-1 | he.camel.processor.Logger 248 | Failed delivery for exchangeId: ID:COMMSPRE-39182-1306750664774-2:48:1:1:1. Exhausted after delivery attempt: 5 caught: java.lang.ClassCastException: org.apache.camel.converter.stream.InputStreamCache cannot be cast to org.w3c.dom.Node. Processed by failure processor: sendTo(Endpoint[activemq://deadletterq.activationrequest]) java.lang.ClassCastException: org.apache.camel.converter.stream.InputStreamCache cannot be cast to org.w3c.dom.Node at com.sun.org.apache.xpath.internal.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:116) at com.sun.org.apache.xpath.internal.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:98) at com.sun.org.apache.xpath.internal.jaxp.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:180) at org.apache.camel.builder.xml.XPathBuilder.doInEvaluateAs(XPathBuilder.java:492) at org.apache.camel.builder.xml.XPathBuilder.evaluateAs(XPathBuilder.java:464) at org.apache.camel.builder.xml.XPathBuilder.matches(XPathBuilder.java:121) at org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:48) at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67) at org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53) at org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82) at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:93) at com.monitor.MonitorXceptorProcessor.process(MonitorXceptorProcessor.java:59) at org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(StreamCachingInterceptor.java:52) at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67) at org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:177) at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:143) at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:88) at org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:56) at org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:231) at org.apache.camel.processor.Pipeline.process(Pipeline.java:74) at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67) at org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53) at org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82) at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:93) at com.monitor.MonitorXceptorProcessor.process(MonitorXceptorProcessor.java:59) at org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(StreamCachingInterceptor.java:52) at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67) at org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:177) at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:143) at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:88) at org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:56) at org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:231) at org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:66) at org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48) at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67) at org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:84) at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:543) at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:482
Re: error in interceptor: InputStreamCache cannot be cast to org.w3c.dom.Node
In your custom interceptor, then you can either - skip any streams (eg do not touch them) - reset the stream cache By resetting the stream cache you should be able to re-read the stram again. There is some code on trunk that does that. On Mon, May 30, 2011 at 1:37 PM, Javier Arias Losada javier.ari...@gmail.com wrote: Hello all, I am implementing a monitor on my routes, using an interceptor. I am using Camel 2.3.0 inside Servicemix 3.3.2. The routes are working ok without the interceptor. In the monitor, I try to log the message, but it seems (not sure about this, just a guess) that that is causing the InputStream to be read and then It seems that it can not be read again. I am already using getContext().setStreamCaching(true); in my routes. Below, you can see the stack trace, any comments or help on this will be welcome. Thank you in advance. Javier Arias. [Fatal Error] :-1:-1: Premature end of file. [Fatal Error] :-1:-1: Premature end of file. [Fatal Error] :-1:-1: Premature end of file. [Fatal Error] :-1:-1: Premature end of file. [Fatal Error] :-1:-1: Premature end of file. 20110530-12:58:52.213 | ERROR | DefaultMessageListenerContainer-1 | he.camel.processor.Logger 248 | Failed delivery for exchangeId: ID:COMMSPRE-39182-1306750664774-2:48:1:1:1. Exhausted after delivery attempt: 5 caught: java.lang.ClassCastException: org.apache.camel.converter.stream.InputStreamCache cannot be cast to org.w3c.dom.Node. Processed by failure processor: sendTo(Endpoint[activemq://deadletterq.activationrequest]) java.lang.ClassCastException: org.apache.camel.converter.stream.InputStreamCache cannot be cast to org.w3c.dom.Node at com.sun.org.apache.xpath.internal.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:116) at com.sun.org.apache.xpath.internal.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:98) at com.sun.org.apache.xpath.internal.jaxp.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:180) at org.apache.camel.builder.xml.XPathBuilder.doInEvaluateAs(XPathBuilder.java:492) at org.apache.camel.builder.xml.XPathBuilder.evaluateAs(XPathBuilder.java:464) at org.apache.camel.builder.xml.XPathBuilder.matches(XPathBuilder.java:121) at org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:48) at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67) at org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53) at org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82) at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:93) at com.monitor.MonitorXceptorProcessor.process(MonitorXceptorProcessor.java:59) at org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(StreamCachingInterceptor.java:52) at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67) at org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:177) at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:143) at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:88) at org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:56) at org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:231) at org.apache.camel.processor.Pipeline.process(Pipeline.java:74) at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67) at org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53) at org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82) at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:93) at com.monitor.MonitorXceptorProcessor.process(MonitorXceptorProcessor.java:59) at org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(StreamCachingInterceptor.java:52) at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67) at org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:177) at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:143) at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:88) at org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:56) at org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:231) at org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:66) at org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48) at org.apache.camel.management.InstrumentationProcessor.process
custom interceptor - wrapProcessorInInterceptors - potential bug.
Hi all, I am implementing a traceability solution on camel. We need a fine grained solution providing a lot of detail, so I am implementing my own custom interceptor. What I want to do is trace each step in the routes and keep the 'parent-child' relation between different exchanges (eg. different exchanges inside the same route when in a split, etc). Also I want to print the customId assigned to each step, so the steps are printed in user-friendly way. I discovered what I think is a bug. I am not sure 100% it is a bug but this is the behaviour I had expected... I am using camel 2.2.0 inside servicemix 3.3.2, but I think that this behaviour is also found in latest camel version. In routes with a split step, when my wrapProcessorInInterceptors method is called, the ProcessorDefinition? paremeter is referencing the Split definition instead of steps inside it. For example, for the route: from(direct:a).routeId(route:a) .split(xpath(//a/b)).id(task:split.products) .log(*** splited ::: body : ${body} ).id(task:handle.that) (*) .setHeader(insplit,constant(in-split)) (*) .end() .log(* aftersplit ::: body : ${body}).id(task:after.split); for steps inside the split (*) the ProcessorDefinition is referencing the splitdefinition, while i think it should point to the log and setHeader steps. It can be easily fixed, in class::: org.apache.camel.processor.DefaultChannel in the method initChannel, changing target = strategy.wrapProcessorInInterceptors(routeContext.getCamelContext(), outputDefinition, target, next); by this: target = strategy.wrapProcessorInInterceptors(routeContext.getCamelContext(), traceDef, target, next); Is this behaviour ok? is it well fixed? This is my first 'contribution' so any advice and help will be more than well received. Thank you and best regards. Javier Arias.
Re: custom interceptor - wrapProcessorInInterceptors - potential bug.
done, FYI : issue 3928 https://issues.apache.org/jira/browse/CAMEL-3928 one question... is this released in older versions like 2.2.0? or have I to use my own patch? thank you. javier arias. 2011/5/2 Claus Ibsen claus.ib...@gmail.com Hi Well spotted. Cane you create a JIRA ticket? On Mon, May 2, 2011 at 11:23 AM, Javier Arias Losada javier.ari...@gmail.com wrote: Hi all, I am implementing a traceability solution on camel. We need a fine grained solution providing a lot of detail, so I am implementing my own custom interceptor. What I want to do is trace each step in the routes and keep the 'parent-child' relation between different exchanges (eg. different exchanges inside the same route when in a split, etc). Also I want to print the customId assigned to each step, so the steps are printed in user-friendly way. I discovered what I think is a bug. I am not sure 100% it is a bug but this is the behaviour I had expected... I am using camel 2.2.0 inside servicemix 3.3.2, but I think that this behaviour is also found in latest camel version. In routes with a split step, when my wrapProcessorInInterceptors method is called, the ProcessorDefinition? paremeter is referencing the Split definition instead of steps inside it. For example, for the route: from(direct:a).routeId(route:a) .split(xpath(//a/b)).id(task:split.products) .log(*** splited ::: body : ${body} ).id(task:handle.that) (*) .setHeader(insplit,constant(in-split)) (*) .end() .log(* aftersplit ::: body : ${body}).id(task:after.split); for steps inside the split (*) the ProcessorDefinition is referencing the splitdefinition, while i think it should point to the log and setHeader steps. It can be easily fixed, in class::: org.apache.camel.processor.DefaultChannel in the method initChannel, changing target = strategy.wrapProcessorInInterceptors(routeContext.getCamelContext(), outputDefinition, target, next); by this: target = strategy.wrapProcessorInInterceptors(routeContext.getCamelContext(), traceDef, target, next); Is this behaviour ok? is it well fixed? This is my first 'contribution' so any advice and help will be more than well received. Thank you and best regards. Javier Arias. -- Claus Ibsen - FuseSource Email: cib...@fusesource.com Web: http://fusesource.com CamelOne 2011: http://fusesource.com/camelone2011/ Twitter: davsclaus Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
Re: custom interceptor - wrapProcessorInInterceptors - potential bug.
On Mon, May 2, 2011 at 2:59 PM, Javier Arias Losada javier.ari...@gmail.com wrote: done, FYI : issue 3928 https://issues.apache.org/jira/browse/CAMEL-3928 one question... is this released in older versions like 2.2.0? or have I to use my own patch? Yep you need to patch your own 2.2.0 versions as we dont do patch releases at Apache for such old releases. thank you. javier arias. 2011/5/2 Claus Ibsen claus.ib...@gmail.com Hi Well spotted. Cane you create a JIRA ticket? On Mon, May 2, 2011 at 11:23 AM, Javier Arias Losada javier.ari...@gmail.com wrote: Hi all, I am implementing a traceability solution on camel. We need a fine grained solution providing a lot of detail, so I am implementing my own custom interceptor. What I want to do is trace each step in the routes and keep the 'parent-child' relation between different exchanges (eg. different exchanges inside the same route when in a split, etc). Also I want to print the customId assigned to each step, so the steps are printed in user-friendly way. I discovered what I think is a bug. I am not sure 100% it is a bug but this is the behaviour I had expected... I am using camel 2.2.0 inside servicemix 3.3.2, but I think that this behaviour is also found in latest camel version. In routes with a split step, when my wrapProcessorInInterceptors method is called, the ProcessorDefinition? paremeter is referencing the Split definition instead of steps inside it. For example, for the route: from(direct:a).routeId(route:a) .split(xpath(//a/b)).id(task:split.products) .log(*** splited ::: body : ${body} ).id(task:handle.that) (*) .setHeader(insplit,constant(in-split)) (*) .end() .log(* aftersplit ::: body : ${body}).id(task:after.split); for steps inside the split (*) the ProcessorDefinition is referencing the splitdefinition, while i think it should point to the log and setHeader steps. It can be easily fixed, in class::: org.apache.camel.processor.DefaultChannel in the method initChannel, changing target = strategy.wrapProcessorInInterceptors(routeContext.getCamelContext(), outputDefinition, target, next); by this: target = strategy.wrapProcessorInInterceptors(routeContext.getCamelContext(), traceDef, target, next); Is this behaviour ok? is it well fixed? This is my first 'contribution' so any advice and help will be more than well received. Thank you and best regards. Javier Arias. -- Claus Ibsen - FuseSource Email: cib...@fusesource.com Web: http://fusesource.com CamelOne 2011: http://fusesource.com/camelone2011/ Twitter: davsclaus Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/ -- Claus Ibsen - FuseSource Email: cib...@fusesource.com Web: http://fusesource.com CamelOne 2011: http://fusesource.com/camelone2011/ Twitter: davsclaus Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
Interceptor in onexception route
I have some routes defined along with onException route like below onException exceptioncom.mycompany.MyException/exception log message=befor ex1 / to uri=ex1 / log message=befor ex2 / to uri=ex2 / /onException route id=id1 from uri=uri1 to uri=uri2 / /route route id=id2 from uri=uri21 to uri=uri22 / /route I have a context wide interceptor defined which intercepts each endpoint and based on endpoint uri it performs some action. It works perfectly fine if there is no exception. Now whenever an exception comes, the onexception gets invoked and my interceptor is supposed to perform custom tracking activities there. but, In case of onException route I noticed that the interceptor is not able to get the current endpoint uri (whereas in normal processing it is able to), I tried exchange.getUnitOfWork() .getRouteContext().getEndpoint().getEndpointUri() and as well as definition.getLabel where definition is processor definition. My question here is can we intercept an onException route ? If yes, what is best way to get the current endpoint uri ? Regards, Ghosh -- View this message in context: http://camel.465427.n5.nabble.com/Interceptor-in-onexception-route-tp4340475p4340475.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Wast performance? Instrument Interceptor is wrapped twice for each processor.
On Sat, Dec 4, 2010 at 2:04 AM, ext2 x...@tongtech.com wrote: Hi, Claus: It's a exciting feature. Hoping it will be available sooner; By the way, it seems the camel 3.0 decide to introduce some new features; While I am using camel, I often meet some requirement which I think if camel support it, things will be better; I always feel embarrassed to raise these question in camel community. Because these questions is somewhat coupling with OSGI environment, and they seems go too faraway from camel. Dont be. We are all still learning the OSGi beast and how its best used in the enterprise integration space. And with Camel we integrate with OSGi out of the box, so we want it to work well together. Despite that OSGi isn't on everybody's love list. But if the camel is gathering requirement, so I am wonder if I could post these questions freely in Camel Community? Following is some examples: Yeah of course. I suggest that you post a new thread on each question / idea you have. Then its easier to keep discussion focused on that particular idea. 1) Dynamic Configurable Component based on OSGI Configuration Admin: By change the OSGI Configuration at runtime, we could change the behavior of Camel Component(Even Endpoint)。 2) Dynamic Expression Service Processor: A Transformer, which could using a expression which is compiled from file's content; and even detecting the file's changing at runtime. When file changed, the language will be reload and recompiled; (just like JSP). 3)OSGI Component: which can directly expose camel route as a OSGI service. If so, we can using OSGI Framework as Service Infrastructure, and using camel as message mediator; and we could leave the JBI (a more heavily Service Infrastructure than OSGI) aside; -- Claus Ibsen - FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
Re: Wast performance? Instrument Interceptor is wrapped twice for each processor.
Thanks Harian Zbarcea: Instrument will be useful. But being wrapped and execute twice for single processor will be a waste; Actually, I found this problem while debug and tracing a spring configured camel route. At least in Camel 2.4.0 and using spring, it real does wrap twice. Maybe you could take a moment to debug and tracking a camel route , you will see it. Or,you can turning on the TRACE level for logging, and checking the Instrument Processor's output. You could see it; Following is my route: route from uri=direct:from / bean id=id0 ref=bean1 method=normal / to id=id0_1 uri=mock:result / bean id=id1 ref=bean1 method=raiseError / /route But the trace result is : 2 of first bean, 2 of the to endpoint, 2 of the second bean and 1 for route; -Origin - Sender: Hadrian Zbarcea [mailto:hzbar...@gmail.com] Date: 2010/12/2 22:21 Receiver: users@camel.apache.org Subject: Re: Wast performance? Instrument Interceptor is wrapped twice for each processor. The InstrumentationProcessor is a delegate processor (aka interceptor) that allows you do do before and after processing. It is not really invoked twice (or I have to see a test case that does that, the unit tests in camel I am aware of don't). It is invoked once, takes a start timestamp, it delegates processing to the inner processor and then takes the time diff and records it. Now with a DelegateProcessor all this call is synchronous. Being actually a DelegateAsyncProcessor, the call to the inner processor is done by the async engine (see AsyncProcessorHelper.process()) which calls asynchronously on the done() method. I assume this is what you see and interpret as a second call. This design is not wasting performance, quite to the contrary. It ensures a better use of resources and scales much better with higher message volume. I hope this helps, Hadrian On Dec 1, 2010, at 9:53 PM, ext2 wrote: Hi: Each camel processor will be wrapped with Instrument Interceptor twice. So for each process , the Instrument interceptor will be executed twice. It seems no use but waste performance; Why? Or a bug? Thanks for any suggestion.
Re: Wast performance? Instrument Interceptor is wrapped twice for each processor.
Sorry, I forget to attach my tracing result; I am sure , it's wrapped twice; Because the Instrument Processor will trace the time only after processing. But one processor 's instrument result is traced twice; Following is my tracing output, you can check it. - bean: Recording duration: 23 millis for exchange: Exchange[Message: plain text] - bean: Recording duration: 52 millis for exchange: Exchange[Message: plain text] - to: Recording duration: 11 millis for exchange: Exchange[Message: plain text] - to: Recording duration: 18 millis for exchange: Exchange[Message: plain text] - bean: Recording duration: 11 millis for exchange: Exchange[Message: plain text] - bean: Recording duration: 48 millis for exchange: Exchange[Message: plain text] - route: Recording duration: 160 millis for exchange: Exchange[Message: plain text] -Original - Sender: ext2 [mailto:x...@tongtech.com] Date: 2010-12-3 19:23 Receiver: users@camel.apache.org Subject: Re: Wast performance? Instrument Interceptor is wrapped twice for each processor. Thanks Harian Zbarcea: Instrument will be useful. But being wrapped and execute twice for single processor will be a waste; Actually, I found this problem while debug and tracing a spring configured camel route. At least in Camel 2.4.0 and using spring, it real does wrap twice. Maybe you could take a moment to debug and tracking a camel route , you will see it. Or,you can turning on the TRACE level for logging, and checking the Instrument Processor's output. You could see it; Following is my route: route from uri=direct:from / bean id=id0 ref=bean1 method=normal / to id=id0_1 uri=mock:result / bean id=id1 ref=bean1 method=raiseError / /route But the trace result is : 2 of first bean, 2 of the to endpoint, 2 of the second bean and 1 for route; -Origin - Sender: Hadrian Zbarcea [mailto:hzbar...@gmail.com] Date: 2010/12/2 22:21 Receiver: users@camel.apache.org Subject: Re: Wast performance? Instrument Interceptor is wrapped twice for each processor. The InstrumentationProcessor is a delegate processor (aka interceptor) that allows you do do before and after processing. It is not really invoked twice (or I have to see a test case that does that, the unit tests in camel I am aware of don't). It is invoked once, takes a start timestamp, it delegates processing to the inner processor and then takes the time diff and records it. Now with a DelegateProcessor all this call is synchronous. Being actually a DelegateAsyncProcessor, the call to the inner processor is done by the async engine (see AsyncProcessorHelper.process()) which calls asynchronously on the done() method. I assume this is what you see and interpret as a second call. This design is not wasting performance, quite to the contrary. It ensures a better use of resources and scales much better with higher message volume. I hope this helps, Hadrian On Dec 1, 2010, at 9:53 PM, ext2 wrote: Hi: Each camel processor will be wrapped with Instrument Interceptor twice. So for each process , the Instrument interceptor will be executed twice. It seems no use but waste performance; Why? Or a bug? Thanks for any suggestion.
Re: Wast performance? Instrument Interceptor is wrapped twice for each processor.
On Fri, Dec 3, 2010 at 2:24 PM, Hadrian Zbarcea hzbar...@gmail.com wrote: I did look at few examples. In your case, from looking at the log, it looks like it's wrapped twice, that's why is executed twice. The second number is always larger than the first. Since the Trace is an interceptor too, it looks like you got an instrument(trace(instrument(processor))). I will take a look today and see where the problem lies. In any event, your assumption is correct, instrumentation should not happen twice, and if does it is a bug. Thanks for pointing this out, Hadrian We'll revisit this in Camel 3.0 where the idea is to make the interception/wrapper dynamic and decided at runtime, instead of laid out at route initialization time. The logic deciding to do this would then be easier to implement. On Dec 3, 2010, at 7:15 AM, ext2 wrote: Sorry, I forget to attach my tracing result; I am sure , it's wrapped twice; Because the Instrument Processor will trace the time only after processing. But one processor 's instrument result is traced twice; Following is my tracing output, you can check it. - bean: Recording duration: 23 millis for exchange: Exchange[Message: plain text] - bean: Recording duration: 52 millis for exchange: Exchange[Message: plain text] - to: Recording duration: 11 millis for exchange: Exchange[Message: plain text] - to: Recording duration: 18 millis for exchange: Exchange[Message: plain text] - bean: Recording duration: 11 millis for exchange: Exchange[Message: plain text] - bean: Recording duration: 48 millis for exchange: Exchange[Message: plain text] - route: Recording duration: 160 millis for exchange: Exchange[Message: plain text] -Original - Sender: ext2 [mailto:x...@tongtech.com] Date: 2010-12-3 19:23 Receiver: users@camel.apache.org Subject: Re: Wast performance? Instrument Interceptor is wrapped twice for each processor. Thanks Harian Zbarcea: Instrument will be useful. But being wrapped and execute twice for single processor will be a waste; Actually, I found this problem while debug and tracing a spring configured camel route. At least in Camel 2.4.0 and using spring, it real does wrap twice. Maybe you could take a moment to debug and tracking a camel route , you will see it. Or,you can turning on the TRACE level for logging, and checking the Instrument Processor's output. You could see it; Following is my route: route from uri=direct:from / bean id=id0 ref=bean1 method=normal / to id=id0_1 uri=mock:result / bean id=id1 ref=bean1 method=raiseError / /route But the trace result is : 2 of first bean, 2 of the to endpoint, 2 of the second bean and 1 for route; -Origin - Sender: Hadrian Zbarcea [mailto:hzbar...@gmail.com] Date: 2010/12/2 22:21 Receiver: users@camel.apache.org Subject: Re: Wast performance? Instrument Interceptor is wrapped twice for each processor. The InstrumentationProcessor is a delegate processor (aka interceptor) that allows you do do before and after processing. It is not really invoked twice (or I have to see a test case that does that, the unit tests in camel I am aware of don't). It is invoked once, takes a start timestamp, it delegates processing to the inner processor and then takes the time diff and records it. Now with a DelegateProcessor all this call is synchronous. Being actually a DelegateAsyncProcessor, the call to the inner processor is done by the async engine (see AsyncProcessorHelper.process()) which calls asynchronously on the done() method. I assume this is what you see and interpret as a second call. This design is not wasting performance, quite to the contrary. It ensures a better use of resources and scales much better with higher message volume. I hope this helps, Hadrian On Dec 1, 2010, at 9:53 PM, ext2 wrote: Hi: Each camel processor will be wrapped with Instrument Interceptor twice. So for each process , the Instrument interceptor will be executed twice. It seems no use but waste performance; Why? Or a bug? Thanks for any suggestion. -- Claus Ibsen - FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
Re: Wast performance? Instrument Interceptor is wrapped twice for each processor.
The InstrumentationProcessor is a delegate processor (aka interceptor) that allows you do do before and after processing. It is not really invoked twice (or I have to see a test case that does that, the unit tests in camel I am aware of don't). It is invoked once, takes a start timestamp, it delegates processing to the inner processor and then takes the time diff and records it. Now with a DelegateProcessor all this call is synchronous. Being actually a DelegateAsyncProcessor, the call to the inner processor is done by the async engine (see AsyncProcessorHelper.process()) which calls asynchronously on the done() method. I assume this is what you see and interpret as a second call. This design is not wasting performance, quite to the contrary. It ensures a better use of resources and scales much better with higher message volume. I hope this helps, Hadrian On Dec 1, 2010, at 9:53 PM, ext2 wrote: Hi: Each camel processor will be wrapped with Instrument Interceptor twice. So for each process , the Instrument interceptor will be executed twice. It seems no use but waste performance; Why? Or a bug? Thanks for any suggestion.
Re: Could camel support configurable interceptor strategy in spring?
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 x...@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
Re: how to implement the instrumentation of from-endpoint?(Should camel to support the route level interceptor)
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 x...@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
Re: how to implement the instrumentation of from-endpoint?(Should camel to support the route level interceptor)
Thanks a lot. It's just what I needed; --- on 2010/10/22 12:38 Willem Jiang [mailto:willem.ji...@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: : Could camel support configurable interceptor strategy in spring?
On Fri, Oct 22, 2010 at 7:39 AM, ext2 x...@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?
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.ib...@gmail.com] wrote: Re: Could camel support configurable interceptor strategy in spring? On Fri, Oct 22, 2010 at 7:39 AM, ext2 x...@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?
On Fri, Oct 22, 2010 at 9:19 AM, ext2 x...@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.ib...@gmail.com] wrote: Re: Could camel support configurable interceptor strategy in spring? On Fri, Oct 22, 2010 at 7:39 AM, ext2 x...@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?
On Fri, Oct 22, 2010 at 11:15 AM, ext2 x...@tongtech.com wrote: Hi, Clause: It seems the Ordered interface of interceptor strategy doesn't works; Could camel support such a feature? What version of Camel are you using? == On Fri, Oct 22, 2010 Claus Ibsen [mailto:claus.ib...@gmail.com] wrote On Fri, Oct 22, 2010 at 9:19 AM, ext2 x...@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.ib...@gmail.com] wrote: Re: Could camel support configurable interceptor strategy in spring? On Fri, Oct 22, 2010 at 7:39 AM, ext2 x...@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 -- 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?
On Fri, Oct 22, 2010 at 11:27 AM, Claus Ibsen claus.ib...@gmail.com wrote: On Fri, Oct 22, 2010 at 11:15 AM, ext2 x...@tongtech.com wrote: Hi, Clause: It seems the Ordered interface of interceptor strategy doesn't works; Could camel support such a feature? What version of Camel are you using? Ah I can see its not support currently, yeah please create a JIRA ticket. == On Fri, Oct 22, 2010 Claus Ibsen [mailto:claus.ib...@gmail.com] wrote On Fri, Oct 22, 2010 at 9:19 AM, ext2 x...@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.ib...@gmail.com] wrote: Re: Could camel support configurable interceptor strategy in spring? On Fri, Oct 22, 2010 at 7:39 AM, ext2 x...@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 -- 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?
Thanks a lot I have raise the issue as: https://issues.apache.org/activemq/browse/CAMEL-3266, On Fri, Oct 22, 2010 at 11:27 AM, Claus Ibsen claus.ib...@gmail.com wrote: On Fri, Oct 22, 2010 at 11:15 AM, ext2 x...@tongtech.com wrote: Hi, Clause: It seems the Ordered interface of interceptor strategy doesn't works; Could camel support such a feature? What version of Camel are you using? Ah I can see its not support currently, yeah please create a JIRA ticket. == On Fri, Oct 22, 2010 Claus Ibsen [mailto:claus.ib...@gmail.com] wrote On Fri, Oct 22, 2010 at 9:19 AM, ext2 x...@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.ib...@gmail.com] wrote: Re: Could camel support configurable interceptor strategy in spring? On Fri, Oct 22, 2010 at 7:39 AM, ext2 x...@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 -- 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
Could camel support configurable interceptor strategy in spring?
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: 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/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: 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
: Could camel support configurable interceptor strategy in spring?
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: need help with interceptor in camel 1.6.2 using custom predicate
Hi I have created an example in 1.x as unit test, which is invoked 3 times. Apache SVN have issue currently with committing so I paste the test here davsclaus:(svn)camel-1x[camel-1.x:925986]/$ svn diff Index: camel-core/src/test/java/org/apache/camel/issues/CBRCustomPredicateAsFilterTest.java === --- camel-core/src/test/java/org/apache/camel/issues/CBRCustomPredicateAsFilterTest.java (revision 0) +++ camel-core/src/test/java/org/apache/camel/issues/CBRCustomPredicateAsFilterTest.java (revision 0) @@ -0,0 +1,82 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the License); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.issues; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.camel.ContextTestSupport; +import org.apache.camel.Exchange; +import org.apache.camel.Predicate; +import org.apache.camel.builder.RouteBuilder; + +/** + * @version $Revision$ + */ +public class CBRCustomPredicateAsFilterTest extends ContextTestSupport { + +private MyFiler filter = new MyFiler(); + +private class MyFiler implements Predicate { + +private ListString bodies = new ArrayListString(); + +public boolean matches(Object exchange) { +Exchange exc = (Exchange) exchange; +String body = exc.getIn().getBody(String.class); +bodies.add(body); + +return !secret.equals(body); +} + +public void assertMatches(String text, Object exchange) throws AssertionError { +// noop +} + +public ListString getBodies() { +return bodies; +} +} + +public void testCBRCustomPredicateAsFilter() throws Exception { +getMockEndpoint(mock:good).expectedBodiesReceived(Hello World, Bye World); +getMockEndpoint(mock:secret).expectedBodiesReceived(secret); + +template.sendBody(direct:start, Hello World); +template.sendBody(direct:start, secret); +template.sendBody(direct:start, Bye World); + +assertMockEndpointsSatisfied(); + +assertEquals(Hello World, filter.getBodies().get(0)); +assertEquals(secret, filter.getBodies().get(1)); +assertEquals(Bye World, filter.getBodies().get(2)); +} + +@Override +protected RouteBuilder createRouteBuilder() throws Exception { +return new RouteBuilder() { +@Override +public void configure() throws Exception { +from(direct:start) +.choice() +.when(filter).to(mock:good) +.otherwise().to(mock:secret); +} +}; +} +} -- 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: need help with interceptor in camel 1.6.2 using custom predicate
Claus, Thanks for your help. Of course you deserve the kudos! I tried the filter method that you described with 1.6.2 and I also upgraded to 2.2 and tried again with interceptors and also with choice().when() What I am finding is this. When I use the custom predicate: public class commentFilter implements Predicate { public static final Log log = LogFactory.getLog(commentFilter.class); //camel 1.x //public boolean matches(Object ex) { public boolean matches(Exchange exchange) { log.debug(Starting filter); //came 1.x //Exchange exchange = (Exchange)ex; String email = exchange.getIn().getBody(Comment.class).getEmail(); if(email.equalsIgnoreCase(jessesanf...@gmail.com)) { log.debug(Skipping this exchange because it was + sent by blacklisted email address: + email); return false; } else { log.debug(Email not blacklisted. Allowing exchange to be routed + email); return true; } } //camel 1.x //public void assertMatches(String s, Object o) { //do nothing //this just satisfies the interface //} } It only executes the predicate one time. On the first message that is passed. I can tell this because I see the following in the logs: 18:19:03,894 DEBUG CommentCaptureController:captureWithJms:117 - captureWithJms 18:19:03,894 DEBUG CommentCaptureController:captureWithJms:117 - captureWithJms 18:19:03,895 DEBUG CommentCaptureController:capture:88 - Start 18:19:03,895 DEBUG CommentCaptureController:capture:88 - Start 18:19:03,896 DEBUG JmsCatcher:catchComment:84 - sending a message. 18:19:03,896 DEBUG JmsCatcher:catchComment:84 - sending a message. 18:19:03,923 INFO SingleConnectionFactory:initConnection:293 - Established shared JMS Connection: PooledConnection { org.apache.activemq.pool.connectionp...@4800ef96 } 18:19:03,934 INFO FailoverTransport:doReconnect:756 - Successfully connected to tcp://localhost:61716 18:19:04,024 INFO VelocityEngine:logVelocityMessage:49 - ResourceManager : found index.vm with loader org.apache.velocity.runtime.resource.loader.FileResourceLoader 18:19:04,077 DEBUG commentFilter:matches:25 - Starting filter 18:19:04,077 DEBUG commentFilter:matches:25 - Starting filter 18:19:04,079 DEBUG commentFilter:matches:31 - Skipping this exchange because it was sent by blacklisted email address: jessesanf...@gmail.com 18:19:04,079 DEBUG commentFilter:matches:31 - Skipping this exchange because it was sent by blacklisted email address: jessesanf...@gmail.com 18:19:28,423 DEBUG CommentCaptureController:captureWithJms:117 - captureWithJms 18:19:28,423 DEBUG CommentCaptureController:captureWithJms:117 - captureWithJms 18:19:28,424 DEBUG CommentCaptureController:capture:88 - Start 18:19:28,424 DEBUG CommentCaptureController:capture:88 - Start 18:19:28,424 DEBUG JmsCatcher:catchComment:84 - sending a message. 18:19:28,424 DEBUG JmsCatcher:catchComment:84 - sending a message. 18:19:28,597 DEBUG JdbcCatcher:capture:204 - done 18:19:28,597 DEBUG JdbcCatcher:capture:204 - done You can see that on the second submit (of the same exact data so the exchange should hold the same info) that the predicate is not run or at least it does not fire the section of the code that has my log message in it. Can you think of any reason why this might be? Ultimately I would like to have the predicate do a jdbc call to a blacklisted email table to check that the messages are allowed through before processing them. Am I pursuing this in the wrong fashion? How would you go about achieving this functionality? Thanks so much! Jesse On Mon, Apr 12, 2010 at 12:09 AM, Claus Ibsen claus.ib...@gmail.com wrote: Hi Jesse btw thanks for the kudo. The interceptors in Camel 1.x is not working super duper. And hence why they have been overhauled in the 2.0 onwards, which would allow you to do what you want. I suggest to search in the camel-core src/test/java directory for any intercept unit tests and see if you can find an example that looks like what you are doing. I assume upgrading to 2.x is not an option. You may instead want to use a Filter EIP in 1.x to build a solution where you can use the predicate to include the good messages in the filter. Then the bad messages can be skipped. On Sun, Apr 11, 2010 at 11:11 PM, Jesse Sanford jessesanf...@gmail.com wrote: I am trying to intercept an exchange using a custom predicate and I am having trouble re-routing the exchange or even simply stoping it. Here is my routebuilder: public class commentRoute extends RouteBuilder{ @Override public void configure(){ intercept().when(isBlacklisted()).to(mock:intercepted).stop(); from(comment-queue).to(comment-catcher); } private Predicate isBlacklisted(){ return new Predicate(){ public boolean matches(Object ex) { Exchange exchange
Re: need help with interceptor in camel 1.6.2 using custom predicate
FYI Here is my routeConfigurator class. You can see from the commented out sections in the configure method that I have tried a lot of different dsl configurations. public class commentRoute extends RouteBuilder { private Predicate commentFilter; @Override public void configure(){ //intercept().when(isBlacklisted()).to(log:comment).stop(); //intercept().to(log:comment).stop(); //from(comment-queue).to(comment-catcher); //from(comment-queue).filter(commentFilter).to(comment-catcher); errorHandler( deadLetterChannel(jms:queue:incoming.deadletterqueue). delayPattern(20s). maximumRedeliveries(5) ); from(comment-queue). choice().when(commentFilter).to(comment-catcher). otherwise().to(jms:queue:incoming.invalid); } /** * Your standard getter * @return the commentFilter */ public Predicate getCommentFilter() { return commentFilter; } /** * Your standard setter * @param commentFilter the commentFilter to set */ public void setCommentFilter(Predicate commentFilter) { this.commentFilter = commentFilter; } private Predicate isBlacklisted(){ return new Predicate(){ public boolean matches(Exchange exchange) { String email = exchange.getIn().getBody(Comment.class).getEmail(); if(email.equalsIgnoreCase(jessesanf...@gmail.com)) { return true; } else { return false; } } }; } } On Mon, Apr 12, 2010 at 6:28 PM, Jesse Sanford jessesanf...@gmail.comwrote: Claus, Thanks for your help. Of course you deserve the kudos! I tried the filter method that you described with 1.6.2 and I also upgraded to 2.2 and tried again with interceptors and also with choice().when() What I am finding is this. When I use the custom predicate: public class commentFilter implements Predicate { public static final Log log = LogFactory.getLog(commentFilter.class); //camel 1.x //public boolean matches(Object ex) { public boolean matches(Exchange exchange) { log.debug(Starting filter); //came 1.x //Exchange exchange = (Exchange)ex; String email = exchange.getIn().getBody(Comment.class).getEmail(); if(email.equalsIgnoreCase(jessesanf...@gmail.com)) { log.debug(Skipping this exchange because it was + sent by blacklisted email address: + email); return false; } else { log.debug(Email not blacklisted. Allowing exchange to be routed + email); return true; } } //camel 1.x //public void assertMatches(String s, Object o) { //do nothing //this just satisfies the interface //} } It only executes the predicate one time. On the first message that is passed. I can tell this because I see the following in the logs: 18:19:03,894 DEBUG CommentCaptureController:captureWithJms:117 - captureWithJms 18:19:03,894 DEBUG CommentCaptureController:captureWithJms:117 - captureWithJms 18:19:03,895 DEBUG CommentCaptureController:capture:88 - Start 18:19:03,895 DEBUG CommentCaptureController:capture:88 - Start 18:19:03,896 DEBUG JmsCatcher:catchComment:84 - sending a message. 18:19:03,896 DEBUG JmsCatcher:catchComment:84 - sending a message. 18:19:03,923 INFO SingleConnectionFactory:initConnection:293 - Established shared JMS Connection: PooledConnection { org.apache.activemq.pool.connectionp...@4800ef96 } 18:19:03,934 INFO FailoverTransport:doReconnect:756 - Successfully connected to tcp://localhost:61716 18:19:04,024 INFO VelocityEngine:logVelocityMessage:49 - ResourceManager : found index.vm with loader org.apache.velocity.runtime.resource.loader.FileResourceLoader 18:19:04,077 DEBUG commentFilter:matches:25 - Starting filter 18:19:04,077 DEBUG commentFilter:matches:25 - Starting filter 18:19:04,079 DEBUG commentFilter:matches:31 - Skipping this exchange because it was sent by blacklisted email address: jessesanf...@gmail.com 18:19:04,079 DEBUG commentFilter:matches:31 - Skipping this exchange because it was sent by blacklisted email address: jessesanf...@gmail.com 18:19:28,423 DEBUG CommentCaptureController:captureWithJms:117 - captureWithJms 18:19:28,423 DEBUG CommentCaptureController:captureWithJms:117 - captureWithJms 18:19:28,424 DEBUG CommentCaptureController:capture:88 - Start 18:19:28,424 DEBUG CommentCaptureController:capture:88 - Start 18:19:28,424 DEBUG JmsCatcher:catchComment:84 - sending a message. 18:19:28,424 DEBUG JmsCatcher:catchComment:84 - sending a message. 18:19:28,597 DEBUG JdbcCatcher:capture:204 - done 18:19:28,597 DEBUG JdbcCatcher:capture:204 - done You can see that on the second submit (of the same exact data so the
Re: need help with interceptor in camel 1.6.2 using custom predicate
I should mention that I am using spring 2.5.x On Mon, Apr 12, 2010 at 6:30 PM, Jesse Sanford jessesanf...@gmail.comwrote: FYI Here is my routeConfigurator class. You can see from the commented out sections in the configure method that I have tried a lot of different dsl configurations. public class commentRoute extends RouteBuilder { private Predicate commentFilter; @Override public void configure(){ //intercept().when(isBlacklisted()).to(log:comment).stop(); //intercept().to(log:comment).stop(); //from(comment-queue).to(comment-catcher); //from(comment-queue).filter(commentFilter).to(comment-catcher); errorHandler( deadLetterChannel(jms:queue:incoming.deadletterqueue). delayPattern(20s). maximumRedeliveries(5) ); from(comment-queue). choice().when(commentFilter).to(comment-catcher). otherwise().to(jms:queue:incoming.invalid); } /** * Your standard getter * @return the commentFilter */ public Predicate getCommentFilter() { return commentFilter; } /** * Your standard setter * @param commentFilter the commentFilter to set */ public void setCommentFilter(Predicate commentFilter) { this.commentFilter = commentFilter; } private Predicate isBlacklisted(){ return new Predicate(){ public boolean matches(Exchange exchange) { String email = exchange.getIn().getBody(Comment.class).getEmail(); if(email.equalsIgnoreCase(jessesanf...@gmail.com)) { return true; } else { return false; } } }; } } On Mon, Apr 12, 2010 at 6:28 PM, Jesse Sanford jessesanf...@gmail.comwrote: Claus, Thanks for your help. Of course you deserve the kudos! I tried the filter method that you described with 1.6.2 and I also upgraded to 2.2 and tried again with interceptors and also with choice().when() What I am finding is this. When I use the custom predicate: public class commentFilter implements Predicate { public static final Log log = LogFactory.getLog(commentFilter.class); //camel 1.x //public boolean matches(Object ex) { public boolean matches(Exchange exchange) { log.debug(Starting filter); //came 1.x //Exchange exchange = (Exchange)ex; String email = exchange.getIn().getBody(Comment.class).getEmail(); if(email.equalsIgnoreCase(jessesanf...@gmail.com)) { log.debug(Skipping this exchange because it was + sent by blacklisted email address: + email); return false; } else { log.debug(Email not blacklisted. Allowing exchange to be routed + email); return true; } } //camel 1.x //public void assertMatches(String s, Object o) { //do nothing //this just satisfies the interface //} } It only executes the predicate one time. On the first message that is passed. I can tell this because I see the following in the logs: 18:19:03,894 DEBUG CommentCaptureController:captureWithJms:117 - captureWithJms 18:19:03,894 DEBUG CommentCaptureController:captureWithJms:117 - captureWithJms 18:19:03,895 DEBUG CommentCaptureController:capture:88 - Start 18:19:03,895 DEBUG CommentCaptureController:capture:88 - Start 18:19:03,896 DEBUG JmsCatcher:catchComment:84 - sending a message. 18:19:03,896 DEBUG JmsCatcher:catchComment:84 - sending a message. 18:19:03,923 INFO SingleConnectionFactory:initConnection:293 - Established shared JMS Connection: PooledConnection { org.apache.activemq.pool.connectionp...@4800ef96 } 18:19:03,934 INFO FailoverTransport:doReconnect:756 - Successfully connected to tcp://localhost:61716 18:19:04,024 INFO VelocityEngine:logVelocityMessage:49 - ResourceManager : found index.vm with loader org.apache.velocity.runtime.resource.loader.FileResourceLoader 18:19:04,077 DEBUG commentFilter:matches:25 - Starting filter 18:19:04,077 DEBUG commentFilter:matches:25 - Starting filter 18:19:04,079 DEBUG commentFilter:matches:31 - Skipping this exchange because it was sent by blacklisted email address: jessesanf...@gmail.com 18:19:04,079 DEBUG commentFilter:matches:31 - Skipping this exchange because it was sent by blacklisted email address: jessesanf...@gmail.com 18:19:28,423 DEBUG CommentCaptureController:captureWithJms:117 - captureWithJms 18:19:28,423 DEBUG CommentCaptureController:captureWithJms:117 - captureWithJms 18:19:28,424 DEBUG CommentCaptureController:capture:88 - Start 18:19:28,424 DEBUG CommentCaptureController:capture:88 - Start 18:19:28,424 DEBUG JmsCatcher:catchComment:84 - sending a message. 18:19:28,424 DEBUG JmsCatcher:catchComment:84 - sending a message.
need help with interceptor in camel 1.6.2 using custom predicate
I am trying to intercept an exchange using a custom predicate and I am having trouble re-routing the exchange or even simply stoping it. Here is my routebuilder: public class commentRoute extends RouteBuilder{ @Override public void configure(){ intercept().when(isBlacklisted()).to(mock:intercepted).stop(); from(comment-queue).to(comment-catcher); } private Predicate isBlacklisted(){ return new Predicate(){ public boolean matches(Object ex) { Exchange exchange = (Exchange)ex; String email = exchange.getIn().getBody(Comment.class).getEmail(); if(email.equalsIgnoreCase(jessesanf...@gmail.com)) { return true; } else { return false; } } public void assertMatches(String s, Object o) { //do nothing //this just satisfies the interface } }; } } I know that the predicate is being run because If I set a breakpoint at if(email.equalsIgnoreCase(jessesanf...@gmail.com)) { and step through the code from there the return true; is reached when i send an exchange with the email address filled in with my email address. Am I doing this all wrong? If this predicate is run and returns true why doesn't camel respect my intercept re-routing or stoping? Thanks so much, jesse
Re: need help with interceptor in camel 1.6.2 using custom predicate
Hi Jesse btw thanks for the kudo. The interceptors in Camel 1.x is not working super duper. And hence why they have been overhauled in the 2.0 onwards, which would allow you to do what you want. I suggest to search in the camel-core src/test/java directory for any intercept unit tests and see if you can find an example that looks like what you are doing. I assume upgrading to 2.x is not an option. You may instead want to use a Filter EIP in 1.x to build a solution where you can use the predicate to include the good messages in the filter. Then the bad messages can be skipped. On Sun, Apr 11, 2010 at 11:11 PM, Jesse Sanford jessesanf...@gmail.com wrote: I am trying to intercept an exchange using a custom predicate and I am having trouble re-routing the exchange or even simply stoping it. Here is my routebuilder: public class commentRoute extends RouteBuilder{ �...@override public void configure(){ intercept().when(isBlacklisted()).to(mock:intercepted).stop(); from(comment-queue).to(comment-catcher); } private Predicate isBlacklisted(){ return new Predicate(){ public boolean matches(Object ex) { Exchange exchange = (Exchange)ex; String email = exchange.getIn().getBody(Comment.class).getEmail(); if(email.equalsIgnoreCase(jessesanf...@gmail.com)) { return true; } else { return false; } } public void assertMatches(String s, Object o) { //do nothing //this just satisfies the interface } }; } } I know that the predicate is being run because If I set a breakpoint at if(email.equalsIgnoreCase(jessesanf...@gmail.com)) { and step through the code from there the return true; is reached when i send an exchange with the email address filled in with my email address. Am I doing this all wrong? If this predicate is run and returns true why doesn't camel respect my intercept re-routing or stoping? Thanks so much, jesse -- 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: Interceptor not working for manually created echanges
Hello Le 10/01/2010 09:43, Claus Ibsen a écrit : The tracer works on the routes only. So it gets activated when any Exchange gets routed to a Camel route. So if you custom code send the Exchange to a direct:foo endpoint which then has a route then it should get traced from(direct:foo).to(bean:foo).to(bean:bar); Then it should trace the routing direct:foo - bean:foo - bean:bar. But NOT the manual code you did to send the Exchange to the direct:foo endpoint. OK, this means things are working as expected. Is the onException clause declared for the context supposed to work for the manual code? By the way, is there a way of adding in the tracer for the manual code? Cheers S. Ali Tokmen savas-ali.tok...@bull.net Office: +33 4 76 29 76 19 GSM:+33 66 43 00 555 Bull, Architect of an Open World TM http://www.bull.com
Re: Interceptor not working for manually created echanges
On Mon, Jan 11, 2010 at 9:01 AM, S. Ali Tokmen savas-ali.tok...@bull.net wrote: Hello Le 10/01/2010 09:43, Claus Ibsen a écrit : The tracer works on the routes only. So it gets activated when any Exchange gets routed to a Camel route. So if you custom code send the Exchange to a direct:foo endpoint which then has a route then it should get traced from(direct:foo).to(bean:foo).to(bean:bar); Then it should trace the routing direct:foo - bean:foo - bean:bar. But NOT the manual code you did to send the Exchange to the direct:foo endpoint. OK, this means things are working as expected. Is the onException clause declared for the context supposed to work for the manual code? No all that is only applicable for routes. By the way, is there a way of adding in the tracer for the manual code? No Tracer is done on routes only as well. Cheers S. Ali Tokmen savas-ali.tok...@bull.net Office: +33 4 76 29 76 19 GSM: +33 66 43 00 555 Bull, Architect of an Open World TM http://www.bull.com -- 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: Interceptor not working for manually created echanges
On Fri, Jan 8, 2010 at 4:31 PM, S. Ali Tokmen savas-ali.tok...@bull.net wrote: Hello I'm currently using CAMEL 2.0.0 with a route that dynamically splits and routes a message to many destinations. I should be using a recipientList() but since the version 2.0.0 doesn't allow any exception handling I'm forced to using a construct like the following: for (Map.EntryString, Message destination : destinations.entrySet()) { Producer expediteur = exchange.getContext().getEndpoint(destination.getKey()).createProducer(); Exchange envoi = expediteur.createExchange(); envoi.setIn(destination.getValue()); expediteur.process(envoi); } This actually works, and the outer processor gets an exception if any destination fails. Here's the issue: in my original context, I had a tracer defined like the following: // Tracer, that will by default log on log4j and send to the // fr.bull.cetebordeaux.traces JMS queue Tracer tracer = new Tracer(); tracer.setFormatter(new CETEMessageFormatter()); tracer.setLogLevel(LoggingLevel.INFO); tracer.setLogName(fr.bull.cetebordeaux.traces); tracer.setDestinationUri(direct:traced); this.from(direct:traced).process(new DefaultTraceEventMessageToStringProcessor()).to(registry:Trace.Queue); this.getContext().addInterceptStrategy(tracer); That tracer is actually not active for the Exchange I've created manually. Is this an expected behaviour? The tracer works on the routes only. So it gets activated when any Exchange gets routed to a Camel route. So if you custom code send the Exchange to a direct:foo endpoint which then has a route then it should get traced from(direct:foo).to(bean:foo).to(bean:bar); Then it should trace the routing direct:foo - bean:foo - bean:bar. But NOT the manual code you did to send the Exchange to the direct:foo endpoint. Cheers -- S. Ali Tokmen savas-ali.tok...@bull.net Office: +33 4 76 29 76 19 GSM: +33 66 43 00 555 Bull, Architect of an Open World TM http://www.bull.com -- 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
Interceptor not working for manually created echanges
Hello I'm currently using CAMEL 2.0.0 with a route that dynamically splits and routes a message to many destinations. I should be using a recipientList() but since the version 2.0.0 doesn't allow any exception handling I'm forced to using a construct like the following: for (Map.EntryString, Message destination : destinations.entrySet()) { Producer expediteur = exchange.getContext().getEndpoint(destination.getKey()).createProducer(); Exchange envoi = expediteur.createExchange(); envoi.setIn(destination.getValue()); expediteur.process(envoi); } This actually works, and the outer processor gets an exception if any destination fails. Here's the issue: in my original context, I had a tracer defined like the following: // Tracer, that will by default log on log4j and send to the // fr.bull.cetebordeaux.traces JMS queue Tracer tracer = new Tracer(); tracer.setFormatter(new CETEMessageFormatter()); tracer.setLogLevel(LoggingLevel.INFO); tracer.setLogName(fr.bull.cetebordeaux.traces); tracer.setDestinationUri(direct:traced); this.from(direct:traced).process(new DefaultTraceEventMessageToStringProcessor()).to(registry:Trace.Queue); this.getContext().addInterceptStrategy(tracer); That tracer is actually not active for the Exchange I've created manually. Is this an expected behaviour? Cheers -- S. Ali Tokmen savas-ali.tok...@bull.net Office: +33 4 76 29 76 19 GSM:+33 66 43 00 555 Bull, Architect of an Open World TM http://www.bull.com
Interceptor
Hi all, Is somebody already using its own interceptor in a xml spring configuration file? In fact, I want to know if in the following definition of intercept, the stop really stops route execution. Cause for me; all other routes are executed. intercept interceptor id=intercept1 ref=MyInterceptor/ to uri=mock:test/ stop/ /intercept Best regards, Mta38 -- View this message in context: http://www.nabble.com/Interceptor-tp22178768p22178768.html Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.
Re: Interceptor
Hi You should not use the interceptor tag, only the intercept. For example: camelContext id=camel xmlns=http://camel.apache.org/schema/spring; intercept to uri=mock:middle1/ stop/ /intercept route from uri=direct:start/ to uri=mock:end/ /route /camelContext On Tue, Feb 24, 2009 at 10:33 AM, mta38 mtaraud@orange-ftgroup.com wrote: Hi all, Is somebody already using its own interceptor in a xml spring configuration file? In fact, I want to know if in the following definition of intercept, the stop really stops route execution. Cause for me; all other routes are executed. intercept interceptor id=intercept1 ref=MyInterceptor/ to uri=mock:test/ stop/ /intercept Best regards, Mta38 -- View this message in context: http://www.nabble.com/Interceptor-tp22178768p22178768.html Sent from the Camel - Users (activemq) mailing list archive at Nabble.com. -- Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/
Interceptor / stop / xml configuration file
Hi all, I want to use interceptor in my route. But I think I may do something wrong Here is my code route from uri=direct:a / intercept interceptor id=intercept1 ref=validateInterceptor/ to uri=mock:test/ stop/ /intercept to uri=direct:b/ /route … other routes … bean id=validateInterceptor class=com.example.interceptors.CheckMessageValidation/ My class CheckMessageValidation extends DelegateProcessor. The process method only adds a trace in a log file. When I test this route, I state that I have the expected trace in my log file, but all other routes are executed. The System does not stop after sending exchange to Mock endpoint. Can anybody can explain me what is wrong in my route. Best regards, Mta38 -- View this message in context: http://www.nabble.com/Interceptor---stop---xml-configuration-file-tp22054882s22882p22054882.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Interceptor / stop / xml configuration file
Hi You should only use the intercept tag, and then route to whatever you want to do route from uri=direct:a / intercept processRef ref=validateInterceptor/ to uri=mock:test/ stop/ /intercept to uri=direct:b/ /route But you can also route to a POJO and do what you like so you dont have to implement any Camel interfaces. intercept beanRef ref=someSpringBean/ to uri=mock:test/ stop/ /intercept On Tue, Feb 17, 2009 at 11:59 AM, mta38 mtaraud@orange-ftgroup.com wrote: Hi all, I want to use interceptor in my route. But I think I may do something wrong Here is my code route from uri=direct:a / intercept interceptor id=intercept1 ref=validateInterceptor/ to uri=mock:test/ stop/ /intercept to uri=direct:b/ /route … other routes … bean id=validateInterceptor class=com.example.interceptors.CheckMessageValidation/ My class CheckMessageValidation extends DelegateProcessor. The process method only adds a trace in a log file. When I test this route, I state that I have the expected trace in my log file, but all other routes are executed. The System does not stop after sending exchange to Mock endpoint. Can anybody can explain me what is wrong in my route. Best regards, Mta38 -- View this message in context: http://www.nabble.com/Interceptor---stop---xml-configuration-file-tp22054882s22882p22054882.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/