简体   繁体   中英

Incremental updates using Camel http component

I need to download incremental updates from a web service. The download URL has a "since" parameter specifying a timestamp, and will return updates after this timestamp:

http://super.service.com/update?since=4535463

This will return an update that contains a timestamp that must be supplied as "since" in the next request:

{ "timestamp": "453575", ... }

The route is triggered periodically by the Quartz component.

My question now is, what is the best way to do this in Camel? So far I have come up with:

  1. Store the timestamp in the route parameters
  2. Store the timestamp in a custom bean
  3. Store the timestamp using the properties component and a custom property resolver

All of these feel too complicated. Also, what is the best way to update the query parameter in the URL

  1. Use URL rewriting
  2. Use the header for the URL parameters (how can I access route properties here?)
  3. Use property placeholders

Any pointers towards best practices would be greatly appreciated.

Regards, Jochen

Why don't you store them in a cache using camel-cache component? Then you can look up the latest timestamp that you got in your previous query from the cache and create your url. The cache component is quit easy to work with and you can use it as part of your java dsl without going into processors or beans.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM