Complext event structure in FIWARE Generic Enabler

2019-09-08 03:49发布

问题:

I'd like to use Proton as CEP GE in my FI-WARE architecture.

I ask your help because I have an event that has a complex structure and I would like to understand how can I define it and the EPA that should use it.

I check in documents you provide in this wiki https://forge.fiware.org/plugins/mediawiki/wiki/fiware/index.php/CEP_GE_-_IBM_Proactive_Technology_Online_User_and_Programmer_Guide and then forge.fiware.org/plugins/mediawiki/wiki/fiware/index.php/Complex_Event_Processing_Open_RESTful_API_Specification and http://forge.fiware.org/plugins/mediawiki/wiki/fiware/index.php/FIWARE.ArchitectureDescription.Data.CEP

but I don't find anything about attributes of type object in event configuration or EPA (Event Process Agent) configuration or how set up the event description using REST api.

the json structure of incoming event is this (I know that name attribute here is missing)

{"contextElements":[
    {"type":"ADD",
    "isPattern":false,
    "id":"ADD_MESSAGE_com.liferay.portlet.messageboards.model.MBMessage_111516",
    "attributes":[
        {"name":"id_","type":"long","value":"32302"},
        {"name":"companyId","type":"long","value":"10157"},
        {"name":"groupId","type":"long","value":"10184"},
        {"name":"userId","type":"long","value":"10201"},
        {"name":"date","type":"date","value":"12-mar-2015"},
        {"name":"type","type":"string","value":"ADD_MESSAGE"},
        {"name":"className","type":"string","value":"com.liferay.portlet.messageboards.model.MBMessage"},
        {"name":"classPK","type":"string","value":"111516"},
        {"name":"classUuid","type":"string","value":"9cd599c5-e01e-417d-9118-a636beed7145"},
        {"name":"model","type":"string","value":"{32302}"}
        ]}
    ],
"updateAction":"APPEND"}

The EPA should then check the "value" of "name":"groupId" "attributes" field. I don't think is easy to do it using Proton UI (http://130.206.81.23:8080/AuthoringTool/Main.html). I created there a new project named is3_like_eng_test.

Could you address me to a resource that deeply explain how create the proton project json file I need also.

Thank you in advance

回答1:

To define an event, you need to create a new Event in the UI, and add to it a list of attributes, each has a name and a type.
In this tutorial you can see an example of event definition.

This event can be used as input event for EPAs. In the tutorial mentioned above, you can see complete CEP application definition, and runtime examples.

Later, at runtime, you can send the CEP input events using REST api. There are three supported formats:

  • Flat JSON. Example:

    {"Name":"TrafficReport", "volume":"1000"}

  • Tag delimited format. Example:

    Name=TrafficReport;volume=1000;

  • NGSI XML - see example in the above link.