问题
I need to pick all the messages from db and send it for reprocessing.
my main requirement is
- i should fetch only certain number of records for each poll and not all the records.
- next poll should get me next set of records and set it for processing.
- 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:
- Select all records where
obj.processedFlag is not null
. - Process the record.
- After processing, set
obj.processedFlag
to a value ≠null
. - 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