ishkin / Proton

IBM Proactive Technology Online
24 stars 21 forks source link

Error in derived event attributes with Aggregate EPA #28

Closed marc0f closed 8 years ago

marc0f commented 8 years ago

Hi, I receive a ContextUpdate event from Orion, and I set a rule to count the numer of the received event, possibly with the same "entityId", over a specific time window. In the derived event of the aggregate EPA, I want that the "DeviceID" attribute assume the same value of the "entityId" of the received event. But, both with "Defered" or "Immediate" evaluation policy, in the DeviceID attribute of the consumer output (text file), I've got:

"DeviceID":"[Ljava.lang.Object;@4456c43f"

Any hint?

Thanks.

Here is the json configuration:

{
"epn": {
    "events": [{
        "name": "DCUPiazzaCarraraContextUpdate",
        "createdDate": "Thu Oct 22 2015",
        "attributes": [{
            "name": "entityId",
            "type": "String",
            "dimension": 0
        }, {
            "name": "entityType",
            "type": "String",
            "dimension": 0
        }, {
            "name": "battery",
            "type": "Double",
            "dimension": 0
        }, {
            "name": "temperature",
            "type": "Double",
            "dimension": 0
        }, {
            "name": "stato",
            "type": "Boolean",
            "dimension": 0
        }, {
            "name": "rssi",
            "type": "Integer",
            "dimension": 0
        }, {
            "name": "lqi",
            "type": "Integer",
            "dimension": 0
        }, {
            "name": "timestamp",
            "type": "String",
            "dimension": 0
        }, {
            "name": "numprog",
            "type": "Integer",
            "dimension": 0
        }, {
            "name": "dcu",
            "type": "String",
            "dimension": 0
        }]
    }, {
        "name": "DCUAbsence",
        "createdDate": "Sat Nov 07 2015",
        "attributes": [{
            "name": "entityId",
            "type": "String",
            "dimension": 0
        }, {
            "name": "entityType",
            "type": "String",
            "dimension": 0
        }, {
            "name": "AlertType",
            "type": "String",
            "dimension": 0
        }, {
            "name": "eventnum",
            "type": "Integer",
            "dimension": 0
        }, {
            "name": "DeviceID",
            "type": "String",
            "dimension": 0
        }, {
            "name": "DeviceContext",
            "type": "String",
            "dimension": 0
        }]
    }],
    "epas": [{
        "name": "AbsenceDCU",
        "createdDate": "Sat Nov 07 2015",
        "epaType": "Aggregate",
        "context": "AbsenceDCUComp",
        "inputEvents": [{
            "name": "DCUPiazzaCarraraContextUpdate",
            "consumptionPolicy": "Reuse",
            "instanceSelectionPolicy": "First"
        }],
        "computedVariables": [{
            "name": "eventnum",
            "aggregationType": "Count",
            "DCUPiazzaCarraraContextUpdate": "1"
        }],
        "evaluationPolicy": "Immediate",
        "cardinalityPolicy": "Unrestricted",
        "internalSegmentation": [],
        "derivedEvents": [{
            "name": "DCUAbsence",
            "reportParticipants": false,
            "expressions": {
                "entityId": "\"Alert\"",
                "entityType": "\"PiazzaCarrara\"",
                "AlertType": "\"006\"",
                "eventnum": "eventnum",
                "DeviceID": "DCUPiazzaCarraraContextUpdate.entityId",
                "DeviceContext": "DCUPiazzaCarraraContextUpdate.entityType"
            }
        }]
    }],
    "contexts": {
        "temporal": [{
            "name": "AbsenceDCUWindow",
            "createdDate": "Sat Nov 07 2015",
            "type": "TemporalInterval",
            "atStartup": false,
            "neverEnding": false,
            "initiators": [{
                "initiatorType": "Event",
                "initiatorPolicy": "Ignore",
                "name": "DCUPiazzaCarraraContextUpdate"
            }],
            "terminators": [{
                "terminatorType": "RelativeTime",
                "terminationType": "Discard",
                "relativeTime": "5000"
            }]
        }],
        "segmentation": [{
            "name": "AbsenceDCUID",
            "createdDate": "Thu Dec 17 2015",
            "participantEvents": [{
                "name": "DCUPiazzaCarraraContextUpdate",
                "expression": "DCUPiazzaCarraraContextUpdate.entityId"
            }, {
                "name": "DCUAbsence",
                "expression": "DCUAbsence.DeviceID"
            }]
        }],
        "composite": [{
            "name": "AbsenceDCUComp",
            "createdDate": "Thu Dec 17 2015",
            "temporalContexts": [{
                "name": "AbsenceDCUWindow"
            }],
            "segmentationContexts": [{
                "name": "AbsenceDCUID"
            }]
        }]
    },
    "consumers": [{
        "name": "OnFileAlert",
        "createdDate": "Thu Oct 22 2015",
        "type": "File",
        "properties": [{
            "name": "filename",
            "value": "/var/log/tomcat7/Alert.json"
        }, {
            "name": "formatter",
            "value": "json"
        }, {
            "name": "delimiter",
            "value": ";"
        }, {
            "name": "tagDataSeparator",
            "value": "="
        }, {
            "name": "SendingDelay",
            "value": "1000"
        }, {
            "name": "dateFormat",
            "value": "dd/MM/yyyy-HH:mm:ss"
        }],
        "events": [{
            "name": "DCUAbsence"
        }, {
            "name": "DCUPiazzaCarraraContextUpdate"
        }]
    }],
    "producers": [],
    "name": "CounterExample"
}

}

talhaham commented 8 years ago

Hi Marco,

Since we are having many users and many CEP questions, we started to document our answers in StackOverflow to help us and our users community. It would be very helpful for us and the community if you could post this question there http://stackoverflow.com/. If you agree, please send me the link to your question, and I will post the answer there. Please add the fiware, cep\ tags. Thank you very much in advanced!

If you don't feel comfortable with posting this question to StackOverflow, please tell me and I will answer you directly.

Thanks, Tali

2015-12-17 14:03 GMT+02:00 Marco notifications@github.com:

Hi, I receive a ContextUpdate event from Orion, and I set a rule to count the numer of the received event, possibly with the same "entityId", over a specific time window In the derived event of the aggregate EPA, I want that the "DeviceID" attribute assume the same value of the "entityId" of the received event But, both with "Defered" or "Immediate" evaluation policy, in the DeviceID attribute of the consumer output (text file), I've got:

"DeviceID":"[LjavalangObject;@4456c43f"

Any hint?

Thanks

Here is the json configuration:

{ "epn": { "events": [{ "name": "DCUPiazzaCarraraContextUpdate", "createdDate": "Thu Oct 22 2015", "attributes": [{ "name": "entityId", "type": "String", "dimension": 0 }, { "name": "entityType", "type": "String", "dimension": 0 }, { "name": "battery", "type": "Double", "dimension": 0 }, { "name": "temperature", "type": "Double", "dimension": 0 }, { "name": "stato", "type": "Boolean", "dimension": 0 }, { "name": "rssi", "type": "Integer", "dimension": 0 }, { "name": "lqi", "type": "Integer", "dimension": 0 }, { "name": "timestamp", "type": "String", "dimension": 0 }, { "name": "numprog", "type": "Integer", "dimension": 0 }, { "name": "dcu", "type": "String", "dimension": 0 }] }, { "name": "DCUAbsence", "createdDate": "Sat Nov 07 2015", "attributes": [{ "name": "entityId", "type": "String", "dimension": 0 }, { "name": "entityType", "type": "String", "dimension": 0 }, { "name": "AlertType", "type": "String", "dimension": 0 }, { "name": "eventnum", "type": "Integer", "dimension": 0 }, { "name": "DeviceID", "type": "String", "dimension": 0 }, { "name": "DeviceContext", "type": "String", "dimension": 0 }] }], "epas": [{ "name": "AbsenceDCU", "createdDate": "Sat Nov 07 2015", "epaType": "Aggregate", "context": "AbsenceDCUComp", "inputEvents": [{ "name": "DCUPiazzaCarraraContextUpdate", "consumptionPolicy": "Reuse", "instanceSelectionPolicy": "First" }], "computedVariables": [{ "name": "eventnum", "aggregationType": "Count", "DCUPiazzaCarraraContextUpdate": "1" }], "evaluationPolicy": "Immediate", "cardinalityPolicy": "Unrestricted", "internalSegmentation": [], "derivedEvents": [{ "name": "DCUAbsence", "reportParticipants": false, "expressions": { "entityId": "\"Alert\"", "entityType": "\"PiazzaCarrara\"", "AlertType": "\"006\"", "eventnum": "eventnum", "DeviceID": "DCUPiazzaCarraraContextUpdateentityId", "DeviceContext": "DCUPiazzaCarraraContextUpdateentityType" } }] }], "contexts": { "temporal": [{ "name": "AbsenceDCUWindow", "createdDate": "Sat Nov 07 2015", "type": "TemporalInterval", "atStartup": false, "neverEnding": false, "initiators": [{ "initiatorType": "Event", "initiatorPolicy": "Ignore", "name": "DCUPiazzaCarraraContextUpdate" }], "terminators": [{ "terminatorType": "RelativeTime", "terminationType": "Discard", "relativeTime": "5000" }] }], "segmentation": [{ "name": "AbsenceDCUID", "createdDate": "Thu Dec 17 2015", "participantEvents": [{ "name": "DCUPiazzaCarraraContextUpdate", "expression": "DCUPiazzaCarraraContextUpdateentityId" }, { "name": "DCUAbsence", "expression": "DCUAbsenceDeviceID" }] }], "composite": [{ "name": "AbsenceDCUComp", "createdDate": "Thu Dec 17 2015", "temporalContexts": [{ "name": "AbsenceDCUWindow" }], "segmentationContexts": [{ "name": "AbsenceDCUID" }] }] }, "consumers": [{ "name": "OnFileAlert", "createdDate": "Thu Oct 22 2015", "type": "File", "properties": [{ "name": "filename", "value": "/var/log/tomcat7/Alertjson" }, { "name": "formatter", "value": "json" }, { "name": "delimiter", "value": ";" }, { "name": "tagDataSeparator", "value": "=" }, { "name": "SendingDelay", "value": "1000" }, { "name": "dateFormat", "value": "dd/MM/yyyy-HH:mm:ss" }], "events": [{ "name": "DCUAbsence" }, { "name": "DCUPiazzaCarraraContextUpdate" }] }], "producers": [], "name": "CounterExample" }

}

— Reply to this email directly or view it on GitHub https://github.com/ishkin/Proton/issues/28.

marc0f commented 8 years ago

Sure, no problem. Here is the link: http://stackoverflow.com/questions/34334194/fiware-cep-proton-error-in-derived-event-attributes-with-aggregate-epa

Thanks, Marco.

talhaham commented 8 years ago

Thank you. I just answered you there. If it was helpful, please accept the answer there. Thanks, Tali

2015-12-17 15:10 GMT+02:00 Marco notifications@github.com:

Sure, no problem. Here is the link:

http://stackoverflow.com/questions/34334194/fiware-cep-proton-error-in-derived-event-attributes-with-aggregate-epa

Thanks, Marco.

— Reply to this email directly or view it on GitHub https://github.com/ishkin/Proton/issues/28#issuecomment-165448646.