Apache Camel JDBC poll and idempotency

I am building a simple camel route that needs to continuously poll the table and insert data into ActiveMQ. Each survey should only retrieve data that has not previously been pulled. The best way I can do this is to keep track of the last successfully processed sequence identifier, and then select items whose sequence identifier is larger than the previous one.

Is there a standard way to do this?

+4
source share
2 answers

Perhaps in a multi-user database for rows with a lower sequence identifier that should be committed after rows with a higher identifier (of course, in Oracle and SQLServer, I suspect in any transactional dbms). In this case, simply tracking the last processed identifier can result in strings that are never processed.

The simplest solution to the problem, if you have control over the schema and the only thing that processes this table, is to add some sort of “processed column to the table” and update that column (as @Arnaud suggests).

If this is not an option, there are 3 other mechanisms that I have considered to solve this problem:

  • , , . , , , , .
  • , . , .
  • . .

2, , , .

+2

Camel sql component onConsume:

"... , Exchange , , ..."

+3

Source: https://habr.com/ru/post/1674834/


All Articles