0
Pattern<Event, ?> pattern = Pattern.<Event>begin("start")
    .next("middle").where(new SimpleCondition<Event>() {
        @Override
        public boolean filter(Event value) throws Exception {
            return value.getName().equals("error");
        }
    }).followedBy("end").where(new SimpleCondition<Event>() {
        @Override
        public boolean filter(Event value) throws Exception {
            return value.getName().equals("critical");
        }
    }).within(Time.seconds(10));

In this example within(Time.seconds(10)),

1、Does it mean that the data is valid for 10 seconds ?

2、Is the expiration data will be deleted after 10s ?

3、if i dont set within(Time.seconds(10)), is data always valid?data dont be detele?

4、if i dont set within(Time.seconds(10)),with more and more data, is it oom ? how to save the data?

thank your help ^^

MARS
  • 1
  • 1

1 Answers1

1

Using within(Time.seconds(10)) means that all of the partial matches that aren't completed within 10 seconds are discarded. Otherwise they are kept around for as long as they might still match, which could be forever, depending on the pattern (and the data stream).

You do have the option of using the RocksDB state backend, in which case the state is kept on disk, rather than in memory. But still, disk is a finite resource too.

If you want to capture these partial matches, rather than simply discarding them when they timeout, you can do this with a TimedOutPartialMatchHandler. See the docs on Handling Timed Out Partial Patterns for more details.

David Anderson
  • 39,434
  • 4
  • 33
  • 60