Re: testing: intercept route and process() *after* its completion?
Hi I have logged a ticket to not forget about this. We should take the opportunity in Camel 3.0 to make the DSL better and support these use-cases. https://issues.apache.org/jira/browse/CAMEL-6901 On Thu, Jun 14, 2012 at 2:54 AM, twelve17 wrote: > Hello, > > I've been diving into Camel testing lately, which, I'm not gonna lie, has > been quite fun. Thanks to the Camel book for assistance. :) > > I did run into one hangup in which I am not sure what the best > pattern/practice is. > > For my integration testing, I am using adviceWith() to "inject" processing > into an existing route. The routebuilder class looks something like: > > @Override > public void configure() throws Exception { > interceptSendToEndpoint("bean:someEndpointToBeTested").process(new > DoSomeAssertionProcessor()); > } > > The code above runs the processor before the intercepted endpoint. What I > would like to do is call a processor *after* the intercepted bean is > completed, so I can verify that the data it produced matches some expected > data set. For the moment, I am using the above pattern to intercept the > endpoint that follows the actual one I want to test, which seems a little > fragile to me. > > I tried using "interceptFrom", but it does not get triggered, which makes me > believe it is only triggered if you are intercepting an input route, versus > matching an output route as if it were "from", from the perspective of when > the pipeline moves to the following route. > > Am I making any sense here? :) > > Any help would be appreciated. > > Thanks, > > Alex > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/testing-intercept-route-and-process-after-its-completion-tp5714460.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
RE: how to intercept route builder "to" route for audit logging
Claus, Probably I didn't explain the problem in much better way. For my audit logs due to security reasons we don't need to the print body information that's why I didn't enable the stream caching. Even otherwise I tried before as well as tried again (added streamCaching to the route) it is still not printing what i am expecting . Please take a close look at the following "expected result and wire tap print" explanation. I am trying to create to http access log kind of audit logging. You can say why can't you enable that, well, our incoming urls are encrypted and so once the incoming URL passes through our security filter I felt routes will give me full control to log what i want. Essentially, I was expecting the first wire tap to print proxy URL and its http response code and the second wire tap to print the Provider URL and its http response code. However, from both the wiretaps Camel is only printing proxy URLs and its response code. What surprises me is after "to("provider url") why it is printing the from("proxy url") information. Please let me know if I you have any quesitons. Thanks, Sridhar As explained earlier, Our HttpLogProcessor contains the following log statement - Message in = exchange.getIn(); System.out.println(in.getHeader(Exchange.HTTP_URL),in.getHeader(Exchange.HTTP_RESPONSE_CODE)); Route DSL from("servlet://Proxy/Vendor/12345") .streamCaching() .wireTap(direct:auditLog).end();[ This wire tap prints : https://proxy-host:6081/Proxy/Vendor/12345 ,<https://proxy-host:6081/Proxy/Vendor/12345,> null<https://proxy-host:6081/Proxy/Vendor/12345,null> where first one is proxy URL and the null is for HTTP response code] [Expected Result: https://proxy-host:6081/Proxy/Vendor/12345 ,<https://proxy-host:6081/Proxy/Vendor/12345,> 200 ] .process(new HttpHeaderProcessor()) .routeId(routeId) .to("https://ProivderHost:6081/Provider/Vendor/12345";) .streamCaching() .process(new CleanupHeaderProcessor()) .wireTap(direct:auditLog).end(); [ This wire tap prints : https://proxy-host:6081/Proxy/Vendor/12345 ,<https://proxy-host:6081/Proxy/Vendor/12345,> 2<https://proxy-host:6081/Proxy/Vendor/12345,null>00 where first one is proxy URL and the 200 is for HTTP response code] [Expected Result: https://ProivderHost:6081/Provider/Vendor/12345 , 200<https://ProivderHost:6081/Provider/Vendor/12345,200> ] From: Claus Ibsen-2 [via Camel] [ml-node+s465427n5725798...@n5.nabble.com] Sent: Saturday, January 19, 2013 3:07 AM To: Dabbeeru, Sridhar V (CGI Federal) Subject: Re: how to intercept route builder "to" route for audit logging Hi See the blue box at http://camel.apache.org/servlet And this FAQ http://camel.apache.org/why-is-my-message-body-empty.html On Fri, Jan 18, 2013 at 8:52 PM, dvsridhar <[hidden email]> wrote: > Hi, > We have to provide audit log for our http routes, for which, we host bunch > http proxy routes using servlet component which routes the request to the > provider using http producer. > > The following route does wireTap after "from" and "to" routes. However, > when the wiretap finishes, i am getting the same from url in both logs. > > In my HttpLogProcessor I am using the following snippet to obtain endpoint > URL. In both the logs I get the same from end point URL and the response > code is null in the first log where as i get the correct response code on > the second log. In nutshell it is not printing the "to" route end point URL. > I could enable trace that prints whole lot for audit log, so, we don't need > all that stuff. > > HttpLogProcessor > > * > Message in = exchange.getIn(); > System.out.println(in.getHeader(Exchange.HTTP_URL),in.getHeader(Exchange.HTTP_RESPONSE_CODE)); > * > > > Route > -- > onException(Exception.class) > .handled(true) > .wireTap(direct:auditLog).end() > .process(new ErrorProcessor()); > > from("servlet://Proxy/Vendor/12345") > * .wireTap(direct:auditLog).end(); > * > .process(new HttpHeaderProcessor()) > .routeId(routeId) > > .to("https:/
Re: how to intercept route builder "to" route for audit logging
Hi See the blue box at http://camel.apache.org/servlet And this FAQ http://camel.apache.org/why-is-my-message-body-empty.html On Fri, Jan 18, 2013 at 8:52 PM, dvsridhar wrote: > Hi, > We have to provide audit log for our http routes, for which, we host bunch > http proxy routes using servlet component which routes the request to the > provider using http producer. > > The following route does wireTap after "from" and "to" routes. However, > when the wiretap finishes, i am getting the same from url in both logs. > > In my HttpLogProcessor I am using the following snippet to obtain endpoint > URL. In both the logs I get the same from end point URL and the response > code is null in the first log where as i get the correct response code on > the second log. In nutshell it is not printing the "to" route end point URL. > I could enable trace that prints whole lot for audit log, so, we don't need > all that stuff. > > HttpLogProcessor > > * > Message in = exchange.getIn(); > System.out.println(in.getHeader(Exchange.HTTP_URL),in.getHeader(Exchange.HTTP_RESPONSE_CODE)); > * > > > Route > -- > onException(Exception.class) > .handled(true) > .wireTap(direct:auditLog).end() > .process(new ErrorProcessor()); > > from("servlet://Proxy/Vendor/12345") > * .wireTap(direct:auditLog).end(); > * > .process(new HttpHeaderProcessor()) > .routeId(routeId) > > .to("https://ProivderHost:6081/Provider/Vendor/12345";) > .process(new CleanupHeaderProcessor()) > * .wireTap(direct:auditLog).end(); > * > > * from(direct:auditLog).process(new > HttpLogProcessor()) > .to(jms:queue:LOG_QUEUE); > * > > from("jms:queue:LOG_QUEUE?concurrentConsumers=3") > .bean(AuditLogProcessor.class,"log"); > > *Expected Result:* > 14:33:50,210 INFO [com.cgi.fdx.common.audit.log.AuditLogProcessor] > https://proxy-host:6081/Proxy/Vendor/12345,200 > > 14:33:53,210,566 INFO [com.cgi.fdx.common.audit.log.AuditLogProcessor] > https://proxy-host:6081/Proxy/Vendor/12345,200 > > *But what we are getting the following Log Trace > > * > 14:33:50,210 INFO [com.cgi.fdx.common.audit.log.AuditLogProcessor] > https://proxy-host:6081/Proxy/Vendor/12345,null > > 14:33:53,210,566 INFO [com.cgi.fdx.common.audit.log.AuditLogProcessor] > https://ProivderHost:6081/Provider/Vendor/12345,200 > > > Wondering how to do this? Do I need to do some sort interceptors to achieve > this? > > Any help appreciated. > > Thanks, > Sridhar > > > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/how-to-intercept-route-builder-to-route-for-audit-logging-tp5725791.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
how to intercept route builder "to" route for audit logging
Hi, We have to provide audit log for our http routes, for which, we host bunch http proxy routes using servlet component which routes the request to the provider using http producer. The following route does wireTap after "from" and "to" routes. However, when the wiretap finishes, i am getting the same from url in both logs. In my HttpLogProcessor I am using the following snippet to obtain endpoint URL. In both the logs I get the same from end point URL and the response code is null in the first log where as i get the correct response code on the second log. In nutshell it is not printing the "to" route end point URL. I could enable trace that prints whole lot for audit log, so, we don't need all that stuff. HttpLogProcessor * Message in = exchange.getIn(); System.out.println(in.getHeader(Exchange.HTTP_URL),in.getHeader(Exchange.HTTP_RESPONSE_CODE)); * Route -- onException(Exception.class) .handled(true) .wireTap(direct:auditLog).end() .process(new ErrorProcessor()); from("servlet://Proxy/Vendor/12345") * .wireTap(direct:auditLog).end(); * .process(new HttpHeaderProcessor()) .routeId(routeId) .to("https://ProivderHost:6081/Provider/Vendor/12345";) .process(new CleanupHeaderProcessor()) * .wireTap(direct:auditLog).end(); * * from(direct:auditLog).process(new HttpLogProcessor()) .to(jms:queue:LOG_QUEUE); * from("jms:queue:LOG_QUEUE?concurrentConsumers=3") .bean(AuditLogProcessor.class,"log"); *Expected Result:* 14:33:50,210 INFO [com.cgi.fdx.common.audit.log.AuditLogProcessor] https://proxy-host:6081/Proxy/Vendor/12345,200 14:33:53,210,566 INFO [com.cgi.fdx.common.audit.log.AuditLogProcessor] https://proxy-host:6081/Proxy/Vendor/12345,200 *But what we are getting the following Log Trace * 14:33:50,210 INFO [com.cgi.fdx.common.audit.log.AuditLogProcessor] https://proxy-host:6081/Proxy/Vendor/12345,null 14:33:53,210,566 INFO [com.cgi.fdx.common.audit.log.AuditLogProcessor] https://ProivderHost:6081/Provider/Vendor/12345,200 Wondering how to do this? Do I need to do some sort interceptors to achieve this? Any help appreciated. Thanks, Sridhar -- View this message in context: http://camel.465427.n5.nabble.com/how-to-intercept-route-builder-to-route-for-audit-logging-tp5725791.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: testing: intercept route and process() *after* its completion?
On Wed, Jun 27, 2012 at 11:05 PM, twelve17 wrote: > > Claus Ibsen-2 wrote >> >> I read this as you want to do some kind of AOP around the sending a >> message >> to a given endpoint? >> We could possible make that a bit easier from testing point of view. >> >> What you can do with the advice with, and code you posted above is to >> - enable the skip sending to endpoint option >> - do assertion before >> - send manually to the endpoint >> - do assertion afterwards >> > > Hi Claus, > > Apologies for the delay in replying. I am trying to perform precisely the > steps you have outlined, perhaps a little less AOP-like than the example > above, at least for the moment. :) > > I have not been able to figure out which API to use to send manually to the > endpoint within the processor before hand. In other words, if my > RouteBuilder looks like this: > > @Override > public void configure() throws Exception { > > interceptSendToEndpoint("bean:someEndpointToBeTested").skipSendToOriginalEndpoint().process(new > DoSomeAssertionProcessor()); > } > > And my processor looks like this: > > public class DoSomeAssertionProcessor implements Processor { > > @Override > public void process(Exchange exchange) throws Exception { > // 1. do pre endpoint assertion > // 2. send to original endpoint here, perhaps using > NotifyBuilder to wait for it to finish? > // 3. do post endpoint assertion > } > } > > How do I accomplish #2? Should I just use a standard producer template? > Yeah a producer template would be fine. Then you can just send the exchange to the endpoint. > Regards, > > Alex > > -- > View this message in context: > http://camel.465427.n5.nabble.com/testing-intercept-route-and-process-after-its-completion-tp5714460p5715186.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: testing: intercept route and process() *after* its completion?
Claus Ibsen-2 wrote > > I read this as you want to do some kind of AOP around the sending a > message > to a given endpoint? > We could possible make that a bit easier from testing point of view. > > What you can do with the advice with, and code you posted above is to > - enable the skip sending to endpoint option > - do assertion before > - send manually to the endpoint > - do assertion afterwards > Hi Claus, Apologies for the delay in replying. I am trying to perform precisely the steps you have outlined, perhaps a little less AOP-like than the example above, at least for the moment. :) I have not been able to figure out which API to use to send manually to the endpoint within the processor before hand. In other words, if my RouteBuilder looks like this: @Override public void configure() throws Exception { interceptSendToEndpoint("bean:someEndpointToBeTested").skipSendToOriginalEndpoint().process(new DoSomeAssertionProcessor()); } And my processor looks like this: public class DoSomeAssertionProcessor implements Processor { @Override public void process(Exchange exchange) throws Exception { // 1. do pre endpoint assertion // 2. send to original endpoint here, perhaps using NotifyBuilder to wait for it to finish? // 3. do post endpoint assertion } } How do I accomplish #2? Should I just use a standard producer template? Regards, Alex -- View this message in context: http://camel.465427.n5.nabble.com/testing-intercept-route-and-process-after-its-completion-tp5714460p5715186.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: testing: intercept route and process() *after* its completion?
On Thu, Jun 14, 2012 at 2:54 AM, twelve17 wrote: > Hello, > > I've been diving into Camel testing lately, which, I'm not gonna lie, has > been quite fun. Thanks to the Camel book for assistance. :) > > I did run into one hangup in which I am not sure what the best > pattern/practice is. > > For my integration testing, I am using adviceWith() to "inject" processing > into an existing route. The routebuilder class looks something like: > > @Override > public void configure() throws Exception { > interceptSendToEndpoint("bean:someEndpointToBeTested").process(new > DoSomeAssertionProcessor()); > } > > The code above runs the processor before the intercepted endpoint. What I > would like to do is call a processor *after* the intercepted bean is > completed, so I can verify that the data it produced matches some expected > data set. For the moment, I am using the above pattern to intercept the > endpoint that follows the actual one I want to test, which seems a little > fragile to me. > > I tried using "interceptFrom", but it does not get triggered, which makes > me > believe it is only triggered if you are intercepting an input route, versus > matching an output route as if it were "from", from the perspective of when > the pipeline moves to the following route. > > Am I making any sense here? :) > > Any help would be appreciated. > > I read this as you want to do some kind of AOP around the sending a message to a given endpoint? We could possible make that a bit easier from testing point of view. What you can do with the advice with, and code you posted above is to - enable the skip sending to endpoint option - do assertion before - send manually to the endpoint - do assertion afterwards > Thanks, > > Alex > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/testing-intercept-route-and-process-after-its-completion-tp5714460.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
testing: intercept route and process() *after* its completion?
Hello, I've been diving into Camel testing lately, which, I'm not gonna lie, has been quite fun. Thanks to the Camel book for assistance. :) I did run into one hangup in which I am not sure what the best pattern/practice is. For my integration testing, I am using adviceWith() to "inject" processing into an existing route. The routebuilder class looks something like: @Override public void configure() throws Exception { interceptSendToEndpoint("bean:someEndpointToBeTested").process(new DoSomeAssertionProcessor()); } The code above runs the processor before the intercepted endpoint. What I would like to do is call a processor *after* the intercepted bean is completed, so I can verify that the data it produced matches some expected data set. For the moment, I am using the above pattern to intercept the endpoint that follows the actual one I want to test, which seems a little fragile to me. I tried using "interceptFrom", but it does not get triggered, which makes me believe it is only triggered if you are intercepting an input route, versus matching an output route as if it were "from", from the perspective of when the pipeline moves to the following route. Am I making any sense here? :) Any help would be appreciated. Thanks, Alex -- View this message in context: http://camel.465427.n5.nabble.com/testing-intercept-route-and-process-after-its-completion-tp5714460.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: intercept route
On Mon, Jun 27, 2011 at 9:25 AM, Guillaume Nodet wrote: > On Mon, Jun 27, 2011 at 09:14, Marco Westermann wrote: >> Hi Guilliaume, >> >> thank you for your answer. But if I use an osgi-service I have to include >> that service into my routes somehow, don't I. Your solution goes this way: >> http://camel.465427.n5.nabble.com/Camel-OSGI-and-container-wide-interceptors-td2269044.html >> ? > > Yeah, I think you're right. > >> Of course the better solution would be to inject every route in all contexts >> without implementing the monitoring in the route-project itself. > > Camel 2.8 is supposed to be released soon, so I guess i'll have to > work on that for 2.9 as I don't have a good understanding of what I > really need yet. > But I think you and me are trying to achieve the same things, so I do > hope we'll find a common solution. > What you guys are looking for is something I think is a goal for Camel 2.5 and the next SMX release. SMX (and OSGi in general) makes it possible to support these kind of use-cases, where you can influence existing apps by installing / removing bundles that has interceptors (and other kind of stuff) that would influence your existing Camel applications. This requires on both SMX and Camel side to open up a bit. For example in Camel we should make it "more dynamic" so its possible from SMX to deploy "real global" interceptors that the Camel applications can pickup and use. Currently the Camel apps is a bit too "static" in this regard. >> regards, Marco >> >> Am 27.06.2011 08:51, schrieb Guillaume Nodet: >>> >>> If they are registered as OSGi services, the InterceptStrategy should >>> be available in all contexts create with spring and blueprint. >>> However this won't work with java or scala DSLs for examples. >>> >>> I'm going to need that for ServiceMix so I hope to have it ready for >>> 2.8, but in the mean time, an OSGi service should work. >>> >>> On Mon, Jun 27, 2011 at 00:21, Marco Westermann >>> wrote: Hi, just tested the interceptor this page describes: http://camel.apache.org/advanced-configuration-of-camelcontext-using-spring.html (chapter: Using container wide interceptors). But this doesn't work for me. If I understand it right, the interceptor is only taken from the routes defined in the same osgi-bundle (jar-file deployed to smx) (this could be the mentioned container) But I want to intercept every route deployed in smx without changing the route itself. My goal is to develop an interactive monitoring tool for camel routes, where you can see the following things: Which routes are active in smx at the moment. Which endpoints have been processed. Which messages have been sent to these endpoints. Therefor I'd like to intercept each route by deploying a seperate component (osgi-bundle) to smx. The component takes the informations about the routes (route-infos, bodies, headers etc.) and sends them to a remote service (maybe a web service). An independent application then can visualize the routes and the messages passed through the routes. One idea is to implement this tool into the smx web-console. If I get this to work, I would like to provide the tool to camel if you are interested in such a thing. best regards, Marco Am 24.06.2011 17:10, schrieb Marco Westermann: > > Hi, > > is it somehow possible to intercept a route from outside the camel > context? I'd like to write a module which intercept every route which is > deployed in SMX and does something with the intercepted messages. > > > Thank you in advance. > > Marco > >>> >>> >> >> > > > > -- > > Guillaume Nodet > > Blog: http://gnodet.blogspot.com/ > > Open Source SOA > http://fusesource.com > -- 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: intercept route
On Mon, Jun 27, 2011 at 09:14, Marco Westermann wrote: > Hi Guilliaume, > > thank you for your answer. But if I use an osgi-service I have to include > that service into my routes somehow, don't I. Your solution goes this way: > http://camel.465427.n5.nabble.com/Camel-OSGI-and-container-wide-interceptors-td2269044.html > ? Yeah, I think you're right. > Of course the better solution would be to inject every route in all contexts > without implementing the monitoring in the route-project itself. Camel 2.8 is supposed to be released soon, so I guess i'll have to work on that for 2.9 as I don't have a good understanding of what I really need yet. But I think you and me are trying to achieve the same things, so I do hope we'll find a common solution. > regards, Marco > > Am 27.06.2011 08:51, schrieb Guillaume Nodet: >> >> If they are registered as OSGi services, the InterceptStrategy should >> be available in all contexts create with spring and blueprint. >> However this won't work with java or scala DSLs for examples. >> >> I'm going to need that for ServiceMix so I hope to have it ready for >> 2.8, but in the mean time, an OSGi service should work. >> >> On Mon, Jun 27, 2011 at 00:21, Marco Westermann >> wrote: >>> >>> Hi, >>> >>> just tested the interceptor this page describes: >>> >>> http://camel.apache.org/advanced-configuration-of-camelcontext-using-spring.html >>> (chapter: Using container wide interceptors). But this doesn't work for >>> me. >>> If I understand it right, the interceptor is only taken from the routes >>> defined in the same osgi-bundle (jar-file deployed to smx) (this could be >>> the mentioned container) But I want to intercept every route deployed in >>> smx >>> without changing the route itself. My goal is to develop an interactive >>> monitoring tool for camel routes, where you can see the following things: >>> >>> Which routes are active in smx at the moment. >>> Which endpoints have been processed. >>> Which messages have been sent to these endpoints. >>> >>> Therefor I'd like to intercept each route by deploying a seperate >>> component >>> (osgi-bundle) to smx. The component takes the informations about the >>> routes >>> (route-infos, bodies, headers etc.) and sends them to a remote service >>> (maybe a web service). An independent application then can visualize the >>> routes and the messages passed through the routes. One idea is to >>> implement >>> this tool into the smx web-console. >>> >>> If I get this to work, I would like to provide the tool to camel if you >>> are >>> interested in such a thing. >>> >>> best regards, >>> >>> Marco >>> >>> Am 24.06.2011 17:10, schrieb Marco Westermann: Hi, is it somehow possible to intercept a route from outside the camel context? I'd like to write a module which intercept every route which is deployed in SMX and does something with the intercepted messages. Thank you in advance. Marco >>> >> >> > > -- Guillaume Nodet Blog: http://gnodet.blogspot.com/ Open Source SOA http://fusesource.com
Re: intercept route
Hi Guilliaume, thank you for your answer. But if I use an osgi-service I have to include that service into my routes somehow, don't I. Your solution goes this way: http://camel.465427.n5.nabble.com/Camel-OSGI-and-container-wide-interceptors-td2269044.html ? Of course the better solution would be to inject every route in all contexts without implementing the monitoring in the route-project itself. regards, Marco Am 27.06.2011 08:51, schrieb Guillaume Nodet: If they are registered as OSGi services, the InterceptStrategy should be available in all contexts create with spring and blueprint. However this won't work with java or scala DSLs for examples. I'm going to need that for ServiceMix so I hope to have it ready for 2.8, but in the mean time, an OSGi service should work. On Mon, Jun 27, 2011 at 00:21, Marco Westermann wrote: Hi, just tested the interceptor this page describes: http://camel.apache.org/advanced-configuration-of-camelcontext-using-spring.html (chapter: Using container wide interceptors). But this doesn't work for me. If I understand it right, the interceptor is only taken from the routes defined in the same osgi-bundle (jar-file deployed to smx) (this could be the mentioned container) But I want to intercept every route deployed in smx without changing the route itself. My goal is to develop an interactive monitoring tool for camel routes, where you can see the following things: Which routes are active in smx at the moment. Which endpoints have been processed. Which messages have been sent to these endpoints. Therefor I'd like to intercept each route by deploying a seperate component (osgi-bundle) to smx. The component takes the informations about the routes (route-infos, bodies, headers etc.) and sends them to a remote service (maybe a web service). An independent application then can visualize the routes and the messages passed through the routes. One idea is to implement this tool into the smx web-console. If I get this to work, I would like to provide the tool to camel if you are interested in such a thing. best regards, Marco Am 24.06.2011 17:10, schrieb Marco Westermann: Hi, is it somehow possible to intercept a route from outside the camel context? I'd like to write a module which intercept every route which is deployed in SMX and does something with the intercepted messages. Thank you in advance. Marco
Re: intercept route
If they are registered as OSGi services, the InterceptStrategy should be available in all contexts create with spring and blueprint. However this won't work with java or scala DSLs for examples. I'm going to need that for ServiceMix so I hope to have it ready for 2.8, but in the mean time, an OSGi service should work. On Mon, Jun 27, 2011 at 00:21, Marco Westermann wrote: > Hi, > > just tested the interceptor this page describes: > http://camel.apache.org/advanced-configuration-of-camelcontext-using-spring.html > (chapter: Using container wide interceptors). But this doesn't work for me. > If I understand it right, the interceptor is only taken from the routes > defined in the same osgi-bundle (jar-file deployed to smx) (this could be > the mentioned container) But I want to intercept every route deployed in smx > without changing the route itself. My goal is to develop an interactive > monitoring tool for camel routes, where you can see the following things: > > Which routes are active in smx at the moment. > Which endpoints have been processed. > Which messages have been sent to these endpoints. > > Therefor I'd like to intercept each route by deploying a seperate component > (osgi-bundle) to smx. The component takes the informations about the routes > (route-infos, bodies, headers etc.) and sends them to a remote service > (maybe a web service). An independent application then can visualize the > routes and the messages passed through the routes. One idea is to implement > this tool into the smx web-console. > > If I get this to work, I would like to provide the tool to camel if you are > interested in such a thing. > > best regards, > > Marco > > Am 24.06.2011 17:10, schrieb Marco Westermann: >> >> Hi, >> >> is it somehow possible to intercept a route from outside the camel >> context? I'd like to write a module which intercept every route which is >> deployed in SMX and does something with the intercepted messages. >> >> >> Thank you in advance. >> >> Marco >> > > -- Guillaume Nodet Blog: http://gnodet.blogspot.com/ Open Source SOA http://fusesource.com
Re: intercept route
Hi, just tested the interceptor this page describes: http://camel.apache.org/advanced-configuration-of-camelcontext-using-spring.html (chapter: Using container wide interceptors). But this doesn't work for me. If I understand it right, the interceptor is only taken from the routes defined in the same osgi-bundle (jar-file deployed to smx) (this could be the mentioned container) But I want to intercept every route deployed in smx without changing the route itself. My goal is to develop an interactive monitoring tool for camel routes, where you can see the following things: Which routes are active in smx at the moment. Which endpoints have been processed. Which messages have been sent to these endpoints. Therefor I'd like to intercept each route by deploying a seperate component (osgi-bundle) to smx. The component takes the informations about the routes (route-infos, bodies, headers etc.) and sends them to a remote service (maybe a web service). An independent application then can visualize the routes and the messages passed through the routes. One idea is to implement this tool into the smx web-console. If I get this to work, I would like to provide the tool to camel if you are interested in such a thing. best regards, Marco Am 24.06.2011 17:10, schrieb Marco Westermann: Hi, is it somehow possible to intercept a route from outside the camel context? I'd like to write a module which intercept every route which is deployed in SMX and does something with the intercepted messages. Thank you in advance. Marco
Re: intercept route
Hi Claus, thank you for your answer, that is exactly I was looking for. Just one last question. Are routes defined in blueprint also intercepted or just the ones defined in spring? At thing point I miss comprehension what happens inside camel and smx. regards, Maro Original-Nachricht > Datum: Sat, 25 Jun 2011 08:59:28 +0200 > Von: Claus Ibsen > An: users@camel.apache.org > Betreff: Re: intercept route > On Fri, Jun 24, 2011 at 5:24 PM, Guillaume Nodet wrote: > > It seems there's currently no easy way to add an InterceptStrategy > > without having full control over the CamelContext. I think what would > > be needed is a static global list of InterceptStrategy that would be > > automatically added to each CamelContext at creation time. That > > should be an easy and safe enhancement to the DefaultCamelContext, but > > I need to make sure it fulfills the need before going that way. > > > > If you use Spring XML files with Camel then you can define X number of > spring beans as interceptors, and they will be picked up and use by > . There is a list of supports types here: > http://camel.apache.org/advanced-configuration-of-camelcontext-using-spring.html > > That said we may want to make that likewise easier to work with OSGi > as well. And some way of defining filters/patterns to include/exclude, > as the OSGi service registry can contain a JVM wide list of > interceptors. And you may only want a certain number of interceptors. > > > Actually, I'm investigating the exact same thing to include in > > ServiceMix. If you're interested, monitor the servicemix dev list as > > I plan to start a thread about that next week. > > > > On Fri, Jun 24, 2011 at 17:10, Marco Westermann > wrote: > >> Hi, > >> > >> is it somehow possible to intercept a route from outside the camel > context? > >> I'd like to write a module which intercept every route which is > deployed in > >> SMX and does something with the intercepted messages. > >> > >> > >> Thank you in advance. > >> > >> Marco > >> > > > > > > > > -- > > > > Guillaume Nodet > > > > Blog: http://gnodet.blogspot.com/ > > > > Open Source SOA > > http://fusesource.com > > > > > > -- > 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/ -- NEU: FreePhone - kostenlos mobil telefonieren! Jetzt informieren: http://www.gmx.net/de/go/freephone
Re: intercept route
On Fri, Jun 24, 2011 at 5:24 PM, Guillaume Nodet wrote: > It seems there's currently no easy way to add an InterceptStrategy > without having full control over the CamelContext. I think what would > be needed is a static global list of InterceptStrategy that would be > automatically added to each CamelContext at creation time. That > should be an easy and safe enhancement to the DefaultCamelContext, but > I need to make sure it fulfills the need before going that way. > If you use Spring XML files with Camel then you can define X number of spring beans as interceptors, and they will be picked up and use by . There is a list of supports types here: http://camel.apache.org/advanced-configuration-of-camelcontext-using-spring.html That said we may want to make that likewise easier to work with OSGi as well. And some way of defining filters/patterns to include/exclude, as the OSGi service registry can contain a JVM wide list of interceptors. And you may only want a certain number of interceptors. > Actually, I'm investigating the exact same thing to include in > ServiceMix. If you're interested, monitor the servicemix dev list as > I plan to start a thread about that next week. > > On Fri, Jun 24, 2011 at 17:10, Marco Westermann wrote: >> Hi, >> >> is it somehow possible to intercept a route from outside the camel context? >> I'd like to write a module which intercept every route which is deployed in >> SMX and does something with the intercepted messages. >> >> >> Thank you in advance. >> >> Marco >> > > > > -- > > Guillaume Nodet > > Blog: http://gnodet.blogspot.com/ > > Open Source SOA > http://fusesource.com > -- 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: intercept route
@Marco, Guillaume probably referred to d...@servicemix.apache.org. However, can you please explain your requirement a bit more? What exactly do you mean by "intercept a route" and what do you mean by "outside the camel context"? Do you refer to intercepting every message flowing through the route, like any normal camel interceptor, or do you mean intercepting the route lifecycle? Also what do you mean from outside the camel context? Have the interceptor be context agnostic or apply the interceptor to all the routes in all the contexts? Also explaining *exactly* what you need to do (without divulging any trade secrets) may allow us to suggest alternative solutions. Cheers, Hadrian On 06/24/2011 05:37 PM, Marco Westermann wrote: Hi, thank you for your answer. What is the dev list I should monitor? For explaination. My plan is to develop a monitoring component, which makes it possible to see, which routes live in smx, which got which messages and how they where routed. regards, Marco Original-Nachricht Datum: Fri, 24 Jun 2011 17:24:31 +0200 Von: Guillaume Nodet An: users@camel.apache.org Betreff: Re: intercept route It seems there's currently no easy way to add an InterceptStrategy without having full control over the CamelContext. I think what would be needed is a static global list of InterceptStrategy that would be automatically added to each CamelContext at creation time. That should be an easy and safe enhancement to the DefaultCamelContext, but I need to make sure it fulfills the need before going that way. Actually, I'm investigating the exact same thing to include in ServiceMix. If you're interested, monitor the servicemix dev list as I plan to start a thread about that next week. On Fri, Jun 24, 2011 at 17:10, Marco Westermann wrote: Hi, is it somehow possible to intercept a route from outside the camel context? I'd like to write a module which intercept every route which is deployed in SMX and does something with the intercepted messages. Thank you in advance. Marco -- Guillaume Nodet Blog: http://gnodet.blogspot.com/ Open Source SOA http://fusesource.com
Re: intercept route
Hi, thank you for your answer. What is the dev list I should monitor? For explaination. My plan is to develop a monitoring component, which makes it possible to see, which routes live in smx, which got which messages and how they where routed. regards, Marco Original-Nachricht > Datum: Fri, 24 Jun 2011 17:24:31 +0200 > Von: Guillaume Nodet > An: users@camel.apache.org > Betreff: Re: intercept route > It seems there's currently no easy way to add an InterceptStrategy > without having full control over the CamelContext. I think what would > be needed is a static global list of InterceptStrategy that would be > automatically added to each CamelContext at creation time. That > should be an easy and safe enhancement to the DefaultCamelContext, but > I need to make sure it fulfills the need before going that way. > > Actually, I'm investigating the exact same thing to include in > ServiceMix. If you're interested, monitor the servicemix dev list as > I plan to start a thread about that next week. > > On Fri, Jun 24, 2011 at 17:10, Marco Westermann > wrote: > > Hi, > > > > is it somehow possible to intercept a route from outside the camel > context? > > I'd like to write a module which intercept every route which is deployed > in > > SMX and does something with the intercepted messages. > > > > > > Thank you in advance. > > > > Marco > > > > > > -- > > Guillaume Nodet > > Blog: http://gnodet.blogspot.com/ > > Open Source SOA > http://fusesource.com -- Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de
Re: intercept route
It seems there's currently no easy way to add an InterceptStrategy without having full control over the CamelContext. I think what would be needed is a static global list of InterceptStrategy that would be automatically added to each CamelContext at creation time. That should be an easy and safe enhancement to the DefaultCamelContext, but I need to make sure it fulfills the need before going that way. Actually, I'm investigating the exact same thing to include in ServiceMix. If you're interested, monitor the servicemix dev list as I plan to start a thread about that next week. On Fri, Jun 24, 2011 at 17:10, Marco Westermann wrote: > Hi, > > is it somehow possible to intercept a route from outside the camel context? > I'd like to write a module which intercept every route which is deployed in > SMX and does something with the intercepted messages. > > > Thank you in advance. > > Marco > -- Guillaume Nodet Blog: http://gnodet.blogspot.com/ Open Source SOA http://fusesource.com
Re: intercept route
You can use: .wireTap("activemq:externalDestination) Then you can have a copy of that message wherever you want it for interception via activeMQ. You could also combine the wiretap with an outbound REST service to ping another webservice with that message... --- Thank You… Mick Knutson, President BASE Logic, Inc. Enterprise Architecture, Design, Mentoring & Agile Consulting p. (855) BASE-LOGIC: (227-3564-42) p. (478) BASE-LOGIC (227-3564-42) f. (855) BASE-LOGIC: (227-3564-42) Website: http://www.baselogic.com Blog: http://www.baselogic.com/blog/ Linked IN: http://linkedin.com/in/mickknutson Twitter: http://twitter.com/mickknutson --- On Fri, Jun 24, 2011 at 11:10 AM, Marco Westermann wrote: > Hi, > > is it somehow possible to intercept a route from outside the camel context? > I'd like to write a module which intercept every route which is deployed in > SMX and does something with the intercepted messages. > > > Thank you in advance. > > Marco >
intercept route
Hi, is it somehow possible to intercept a route from outside the camel context? I'd like to write a module which intercept every route which is deployed in SMX and does something with the intercepted messages. Thank you in advance. Marco