Skip to end of metadata
Go to start of metadata

Reaction groups (see Structure of reaction groups) is a mechanism for defining multiple reactions in a common context. Associating common semantics, timeout, aggregations are typical contextual enrichments of primitive message processing. Using variables and constraints is another context-wide functionality of reaction groups in Prova.

Each reaction in an @and event processing group can have a @vars annotation that lists all Prova variables occurring in the reaction pattern or its context to be made available to constraint solving based on more than one reaction in the group. This is particularly useful when we are looking for @and patterns that include undefined orderings of events with specific constraints between them. Note that in the case of a "followed by" operator, earlier reactions set the appropriate variables and a simple guard on subsequent reaction is sufficient for specifying constraints.

The annotation @vars works in such a way that equational constraints do not need to be explicit, i.e., as far as the syntax is concerned, it is sufficient to reuse the same names of one or more variables in multiple reactions for these variables to be equated in any detected sequence of events. The test and_vars.prova demonstrates this functionality. It detects in the inbound stream one unordered login/logout pair with matching User and IP.


This example will print:


The test and_multi_vars.prova adds @count annotations to allow for more than one detection to be emitted from one active pattern group instance.


This will print:


Finally, the annotation @where can carry expressions in a simple constraint language that are used for verifying constraints involving different context variables from multiple reactions. You can use various comparison operators as well as use logical connectives for building more complex logical expressions. The test where.prova shows how it all works together.


This will print:


Labels: