[英]Incremental updates using Camel http component
I need to download incremental updates from a web service. 我需要从Web服务下载增量更新。 The download URL has a "since" parameter specifying a timestamp, and will return updates after this timestamp:
下载URL具有一个“ since”参数,用于指定时间戳记,并将在此时间戳记之后返回更新:
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. 该路由由Quartz组件定期触发。
My question now is, what is the best way to do this in Camel? 我现在的问题是,在骆驼中做到这一点的最佳方法是什么? So far I have come up with:
到目前为止,我已经提出了:
All of these feel too complicated. 所有这些感觉太复杂了。 Also, what is the best way to update the query parameter in the URL
另外,更新URL中查询参数的最佳方法是什么
Any pointers towards best practices would be greatly appreciated. 任何有关最佳做法的指示将不胜感激。
Regards, Jochen 此致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.
然后,您可以从缓存中查找先前查询中获得的最新时间戳,并创建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.
缓存组件非常易于使用,您可以将其用作java dsl的一部分,而无需使用处理器或bean。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.