I have a scenario where I need to detect following pattern for a transaction.
My basic transaction event look like this => Transaction(id,status, time)
Transaction goes through following state.
BEGIN -> COMPLETE (within 5 day, if this comes then no need to wait for PROCESSING)
BEGIN -> PROCESSING (within 1 day)
PROCESSING -> PROCESSING (within 1 day, could happen upto 5 days)
PROCESSING -> COMPLETE (within 1 day)
In plain text, basically when a transaction is initiated it can go from BEGIN to COMPLETE in 5 days. But If its can not be completed within 1 day then it keep sending a PROCESSING event on that day. So this can happen upto 5 day and then finally it can send COMPLETE event.
I want to alert if there is any diversion form this pattern.
The number of transaction in a day could be 10-50 million. I am evaluating FlinkCEP for this problem. I have gone through their doc https://ci.apache.org/projects/flink/flink-docs-release-1.4/dev/libs/cep.html
Is it possible to design this pattern using Flink CEP?
Also if I am not wrong , I need to use PatternTimeoutFunction to trigger alert.