As in the title: Is it possible to use just flink pattern matching without whole other flink enviroment?
2 Answers
Flink CEP library is not intended to be used outside of Flink, therefore it is not possible out of the box.
However the underlying automaton does not depend on any Flink code, so you could extract it yourself. The interesting classes would be NFA
and NFACompiler
.

- 3,402
- 17
- 33
I guess you are asking this question because the problem you are trying to solve may have some memory requirements or you want to perform some changes in Pattern class.
In case you have memory issues, you can go ahead and use Esper or Siddhi CEP engines as they don't have dependencies like Flink has.
For the second case i.e you want to make some changes to pattern file or see how query processing works then you should use NFA class as @Dawid pointed out. This is because CEP pattern matching works basically by parsing query tree as Non-deterministic Finite Automata which receives input streams at Leaf nodes and use operators at each level to co-relate values of streams and filter values, send it to the upper level operator for filtering and so on. Final values are received at the root of this tree.
Particularly I found SASE engine helpful if you are going to interact with low level and basic CEP engine. link for SASE paper is https://arxiv.org/ftp/cs/papers/0612/0612128.pdf
You can look code of NFA file to get more understanding https://github.com/haopeng/sase/tree/master/src/edu/umass/cs/sase/query
Please let me know if you have some query

- 2,718
- 3
- 23
- 62