Caching a header from one route to another #1070
Replies: 5 comments 1 reply
-
@davsclaus is Caffeine Cache component scope is Route or CamelContext? |
Beta Was this translation helpful? Give feedback.
-
You can bind the cache to registry and re-use the same instance in multiple routes of the context https://camel.apache.org/components/4.0.x/caffeine-cache-component.html#_examples |
Beta Was this translation helpful? Give feedback.
-
its context scoped (in reality per component), also it creates a default in-memory cache if not specially created as the link from Andrea above. |
Beta Was this translation helpful? Give feedback.
-
Thanks @davsclaus and @oscerd @samar-elsayed you can not put header directly to Caffeine. Set the data you want to cache to exchange body and then put into caffeine cache. In the second route get data from caffeine (it will be in exchange body) and then setHeader from the body.
|
Beta Was this translation helpful? Give feedback.
-
Based on my last reply, I have tried to enrich the original body in the current route with the cached token from the previous route with this Aggregation Strategy
but it fails with me with:
so please advise if there is a better way to have the cached body as a header along with the original body Thanks! |
Beta Was this translation helpful? Give feedback.
-
Hi,
I am trying to cache a certain header (CamelCaffeineKey) to use it in another route so I have tried caffeine-cache but I dont seem to be able to make it work, could you please explain to me how to use it / load the cache from the first route to the other route?
Beta Was this translation helpful? Give feedback.
All reactions