I’m using Couchbase 6.5.1 and Java Client SDK 2.7.1 and Flink to stream the message from kafka to Couchbase
Right now I’ using KV async to get then upsert back the data.
I’m having issue with sequence of concurrent data
(Message from kafka is sequential a,b,c,d) and need to store in couchbase with latest data (d)
I have plan to use CAS (Compare and Swap) with below logic:
When CasMismatchExcption, it will sleep 1 sec then retry.
I assume during sleep, the retry message will not know the sequence from kafka anymore so that the sequence will be wrong
How’s the best practice to handle this kind of issue?
Is there any sample java code for this?