On Fri, Jan 22, 2010 at 10:29 AM, SwenVogel <swen.vo...@ypsystems.de> wrote: > > Hi, > > i use the send() method of the producer template, like in the code snippet > from the first post. > > Means "Custom OnCompletion is triggered when you use a route." that when > i use a standard component for example "file" that the > GenericFileOnCompletion is triggered? > > I thought that a component is like a encapsulated logical unit but it seems > that the internal > semantic changes when i use a route or the ProducerTemplate. It's a little > bit confusing. >
All the cross cutting functions such as interceptors, on completion, on exception is route based. Camel does a lot of stuff when building routes which allows it to weave in those cross cutting stuff at the right places etc. You can add some custom completion to your component if its important for your component that it does some cleanup etc. > For example when i write a component that must do some important kind of > cleanup > after processing, this cleanup must be done regardless whether i use a route > or a > ProducerTemplate. > > Is there a way to manually trigger the OnCompletitions's? > No, you can however use the asyncXXXCallback method from producer template which offers on completion callbacks > > > Claus Ibsen-2 wrote: >> >> Hi >> >> Do you send directly to the endpoint of your custom component? >> Custom OnCompletion is triggered when you use a route. >> >> >> >> On Thu, Jan 21, 2010 at 4:30 PM, SwenVogel <swen.vo...@ypsystems.de> >> wrote: >>> >>> Hi, >>> >>> i created a customer jetty security handler and configured the spring >>> configuration file accordingly. >>> In the security handler i use my own "exec" camel component for the >>> authentication. >>> >>> In short my "exec" component can executes external programs and makes use >>> of >>> the >>> apache-commons-exec library. >>> >>> The problem is that the OnCompletition's are not called. When is use the >>> component >>> in other routes everything works fine. >>> >>> Here is the code from my "exec" producer that adds the OnCompletition: >>> exchange.addOnCompletion(new ExecOnCompletition(endpoint, processIO)); >>> >>> >>> Here the security handler code: >>> >>> String authEndpoint = "exec:authProg?dir=c:/&exitValues=0;1&args=" >>> + username + ";" >>> + credentials; >>> >>> ProducerTemplate template = camelContext.createProducerTemplate(); >>> Exchange result = template.send(authEndpoint, new >>> DefaultExchange(camelContext)); >>> >>> Integer exitCode = result.getOut().getHeader( >>> ExecComponent.EXEC_EXITCODE, Integer.class); >>> >>> -- >>> View this message in context: >>> http://old.nabble.com/Jetty-Security-Handler-tp27259580p27259580.html >>> Sent from the Camel - Users mailing list archive at Nabble.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 >> >> > > -- > View this message in context: > http://old.nabble.com/Jetty-Security-Handler-tp27259580p27270602.html > Sent from the Camel - Users mailing list archive at Nabble.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