Search code examples
fiwarecomplex-event-processing

Assigning values between events


We have a question concerning the assignment of values between events in Fiware CEP.

Suppose that, based on two triggered events, a third event is initiated. So let’s assume they are called event A, B and C. If A and B are triggered, C should be triggered, assuming that the conditions in EPA are met.

From the log files we can determine that event A and B are being triggered, but event C is triggered but empty. We are so far unable to assign values from event A and B to event C. Our goal is to provide event C with details (a summation of two integers from event A and B) from the events it is triggered by.

Could you provide us with some information into how we can assign values from one event to a new event. Is it possible to use 2 events as input values for a new event? We have tried to assign values to event C by providing them with default values (i.e. by referring to A.variable_1). Also we have tried to assign new event attributes in the EPA -> derivation -> event attributes.

In our Proactive authoring tool we cannot find the solution to our problem. We know the mathematical functions, as described in the user guide, but we failed to deduce how to assign a value from a mathematical function from one event to a new event.


Solution

  • If you want to generate event C when event A, B occurred, you can use an EPA of type All, and put both A, B events as participant events of the EPA.

    In this EPA you need to add C event as derived event. In the Authoring tool, open the EPA definition, and choose to add C as derived event, open its attributes table, and set the attribute you want to be equal to some function based on A,B events (e.g., A.Value + B.Value).

    See the screen shot taken from the CEP Authoring tool, where the attribute Value of the C derived event is given the value A.Value + B.Value

    Make sure you run the CEP with your updated definition file. You need to export it to the repository (from the authoring tool), and then to stop and start the CEP in order to have it run with the updated definition set.

    Set the Value attribute of the derived event C