camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "raulvk.soa" <raulvk....@gmail.com>
Subject Re: Custom log messages
Date Tue, 16 Sep 2008 15:51:30 GMT

Hi,

Just a contribution.

I think a good verb for this action would be "branch". Correct me if I am
wrong, but what you are actually doint is spawning a new thread that would
do some further processing on a copy of the initial message, and once the
thread is done, the Exchange object associated with it would be scrapped
away. In the parallel, the main processing flow would continue within the
main, core branch.

So I suggest something like:

from("jbi:xxx")
    .branch().log("Transforming message. Source: {in.message}",
<loggingCategory>)      
    .to("jbi:service:http://mycompany.org/SaxonTransformMessage")
    .branch().log("Message transformed. Result: {out.message}",
<loggingCategory>);

The branch() action actually creates a copy of the current message in the
pipeline and spawns a new thread that executes the following actions.

In my imagination, the log() method would create a new header in the message
that contains the specified log message, and would immediately invoke a new
LogProcessor that would take the message out from this header, substitute
the tokens with the appropriate content, and finally call the Logger
associated with the specified logging category.

What do you think?

>From a user's point of view, I honestly believe the clearest keyword to use
for this new pattern is "branch()".

Raul.


Gert Vanthienen wrote:
> 
> James,
> 
> We could also look at it from the interceptor end and improve that so it 
> knows where it is being invoked in the route.  For example: if the 
> interceptor knows about the previous/next step in the route is, it can 
> also log other messages based on where in the route it is (or omit 
> logging for some steps).
> 
> Regards,
> 
> Gert
> 
> James Strachan wrote:
>> Btw, isn't it possible to do the same thing with an interceptor?
>>   
>>
>> Yeah you could do the same thing with an interceptor - I was just
>> thinking that you'd maybe want a specific logging message each time
>> its used. I guess an analogy is, I was pondering about whats the Camel
>> DSL equivalent of shoving in a LOG.info("foo") inside any line of a
>> route definition - which doesn't affect the flow at all. You can use
>> the tracer or add an interceptor to always log each step; but
>> sometimes you just wanna insert custom messages at specific points.
>>
>>   
> 
> 
> 
> -----
> ---
> Gert Vanthienen
> http://www.anova.be
> 

-- 
View this message in context: http://www.nabble.com/Custom-log-messages-tp19508418s22882p19514692.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message