camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lsantos <>
Subject Cache api call result
Date Mon, 07 Nov 2016 15:00:44 GMT
Hi there,

I am working on a command-line camel application that polls a directory for
a file, reads it, process each line, modifies a piece of information on the
line and rewrites it in new file.

I have to make 2 http calls as part of the msg enrichment process, the first
call is as authorization call that gets a json web token that is sent in the
headers of the second http call.

My route dsl looks something like this:

                        .setHeader(Exchange.HTTP_METHOD, constant("POST")) 
                        // call that I want its result cached for reuse
getFirstAggregationStrategy()) .setHeader(Exchange.HTTP_METHOD,
                    .end() //end choice

It is all good and working, however, the file that gets processed in
production has millions of lines and I do not want to have to make an extra
authorization http call for each record that is processed, as the json web
token is valid for 20 minutes before it expires which is less than what
takes to process one entire file.

I would like to keep the jwt auth token cached in memory for let's say 15
minutes and refresh it periodically.

I was wondering how is the best approach to achieve this goal. I know that
camel ships with a timer component, but I never worked with it.

View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message