September 2017
Beginner to intermediate
360 pages
8h 13m
English
Let's take one more example with the following code, which explains the available pattern API and their use. Here in this example we are generating an alert in case a mobile/IOT device generates data of more than 15 MB within 10 seconds:
Pattern<DeviceEvent, ?> alertPattern = Pattern.<DeviceEvent>begin("first").subtype(DeviceEvent.class).where(new DeviceFilterFunction()).followedBy("second").subtype(DeviceEvent.class).where(new DeviceFilterFunction()).within(Time.seconds(TXN_TIMESPAN_SEC));
In the preceding snippet, we defined the pattern to be matched with each event of the data stream:
PatternStream<DeviceEvent> tempPatternStream = CEP.pattern(messageStream.rebalance().keyBy("phoneNumber"), alertPattern);
In the preceding snippet, ...
Read now
Unlock full access