camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Jetty Security Handler
Date Fri, 22 Jan 2010 11:12:13 GMT
On Fri, Jan 22, 2010 at 10:29 AM, SwenVogel <swen.vogel@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.
>
> 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?
>

You can always manually invoke it

Synchronization onComp = ...
Exchange result = template.send(xxxx);

comp.onComplete(result);





>
>
> 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.vogel@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

Mime
View raw message