Resolution: Issue:
========
Pattern Matching failure listener is not called.
For this pattern string:
String inventoryPatternString = "define pattern /Patterns/InvReqAggregator \n" +
" using /Events/InventoryRequest as ir \n" +
" with ir.SKU" +
" starts with ir then within 60 seconds repeat 0 to 5 times ir";
This pattern aggregates at most six InventoryRequest events within a span of 60 seconds. If there is a success listener and a failure listener, if less than 6 events are sent, such as 2, after 60 seconds it will trigger the success listener which is expected. But if there are more than 6 events, such as 7, a timeout after 60 seconds is seen but it still triggers a success listener even though it should have triggered the failure listener.
Resolution:
========
Use the "during" clause rather than the "within" clause.
Corrected query:
String inventoryPatternString = "define pattern /Patterns/InvReqAggregator \n" +
" using /Events/InventoryRequest as ir \n" +
" with ir.SKU" +
" starts with ir then during 60 seconds repeat 0 to 5 times ir";