fetch specific set of records for each poll without setting the flag in camel

三世轮回 提交于 2019-12-31 05:29:15

问题


I need to pick all the messages from db and send it for reprocessing.

my main requirement is

  1. i should fetch only certain number of records for each poll and not all the records.
  2. next poll should get me next set of records and set it for processing.
  3. i should not use processedFlag column in the table - this is not allowed.

I am free to use any camel component such as jpa, sql , jdbc etc.,

Help is greatly appreciated.


回答1:


You could use the Batch Consumer as described here - https://camel.apache.org/batch-consumer.html




回答2:


Adding a trigger variable such as processedFlag is definitely the simplest way to go. Initially this variable is set to null.

Procedure:

  1. Select all records where obj.processedFlag is not null.
  2. Process the record.
  3. After processing, set obj.processedFlag to a value ≠ null.
  4. Begin at 1.

Not using a trigger variable would only produce a fair amount of headaches, I guess.



来源:https://stackoverflow.com/questions/22515018/fetch-specific-set-of-records-for-each-poll-without-setting-the-flag-in-camel

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!