Skip to content

Problems receiving notifications with a NGSI-LD operator #392

@Blobonat

Description

@Blobonat

Hi,

following the old Integrate FogFlow with Other NGSI-LD Broker tutorial I am trying to connect the Scorpio Broker with FogFlow.
I was able to create the NGSI-LD subscription (from Scorpio to FogFlow) and write my own operator using the JavaScript NGSI-LD operator template . The NGSI-LD notifications are successfully sent to FogFlow, but inside my operator I receive the notifications in NGSI-V1 style instead of the NGSI-LD format. Therefore the notifications can't be parsed by the provided ngsiagent inside the NGSI-LD operator template.

Logging the received body inside the ngsiagent:

{"subscriptionId":"a7d23742-4731-11ed-9803-0242ac120008","originator":"","contextResponses":[{"contextElement":{"entityId":{"type":"Building","id":"urn:ngsi-ld:Building:testBuilding01"},"attributes":[{"name":"airTemperature","type":"float","value":-9.5}]},"statusCode":{"code":200,"reasonPhrase":"OK"}}]}

Is there any additional configuration to be able to receive notifications in the NGSI-LD format inside my operator/fog function?

I followed step 4 of the tutorial to create my operator and the fog function. To run FogFlow I use the default docker-compose.yml from the current documentation.


Master log

DEBUG: 2022/10/08 17:50:10 taskMgr.go:544: [Unique Key Table]: map[Building-EntityID:[urn:ngsi-ld:Building:testBuilding01]]
DEBUG: 2022/10/08 17:50:10 taskMgr.go:243: [related groups]:  [map[Building-EntityID:urn:ngsi-ld:Building:testBuilding01]]
DEBUG: 2022/10/08 17:50:10 taskMgr.go:102: group k: Building-EntityID, v: urn:ngsi-ld:Building:testBuilding01
INFO: 2022/10/08 17:50:10 # hash = 235109731
DEBUG: 2022/10/08 17:50:10 taskMgr.go:102: group k: Building-EntityID, v: urn:ngsi-ld:Building:testBuilding01
DEBUG: 2022/10/08 17:50:10 taskMgr.go:102: group k: Building-EntityID, v: urn:ngsi-ld:Building:testBuilding01
DEBUG: 2022/10/08 17:50:10 taskMgr.go:339: new task {TaskID:Task.StateEstimation.stateEstimation.235109731 Name:stateEstimation Operator:road-state-estimator WorkerID: Status:scheduled Inputs:[{ID:urn:ngsi-ld:Building:testBuilding01 Type:Building AttributeList:[] Location:{Latitude:0 Longitude:0}}] Outputs:[0xc0003aa480]}, hashID 235109731, taskID Task.StateEstimation.stateEstimation.235109731
DEBUG: 2022/10/08 17:50:10 taskMgr.go:894: [Orchestration Action]:  ADD_TASK {Task.StateEstimation.stateEstimation.235109731 StateEstimation stateEstimation ServiceIntent.fb4ef5e8-3def-425f-a4c4-2ef9bc98b15f road-state-estimator    []  false 0 scheduled [{Building urn:ngsi-ld:Building:testBuilding01 []}] [{Out Out.235109731.1 []}]}
INFO: 2022/10/08 17:50:10 {ADD_TASK Worker.001. Master.001 {Task.StateEstimation.stateEstimation.235109731 StateEstimation stateEstimation ServiceIntent.fb4ef5e8-3def-425f-a4c4-2ef9bc98b15f road-state-estimator   MY_DOCKER_IMAGE [] Worker.001 false 0 scheduled [{Building urn:ngsi-ld:Building:testBuilding01 []}] [{Out Out.235109731.1 []}]}}
INFO: 2022/10/08 17:50:10 [Task update]:  &{Task.StateEstimation.stateEstimation.235109731 StateEstimation stateEstimation ServiceIntent.fb4ef5e8-3def-425f-a4c4-2ef9bc98b15f running}

Worker log

INFO: 2022/10/08 17:50:10 ADD_TASK
INFO: 2022/10/08 17:50:10 execute task  Task.StateEstimation.stateEstimation.235109731  with operation MY_DOCKER_IMAGE:latest
INFO: 2022/10/08 17:50:10 task configuration {ID:Task.StateEstimation.stateEstimation.235109731 TopologyName:StateEstimation TaskName:stateEstimation ServiceIntentID:ServiceIntent.fb4ef5e8-3def-425f-a4c4-2ef9bc98b15f OperatorName:road-state-estimator TaskType: FunctionCode: DockerImage:MY_DOCKER_IMAGE:latest Parameters:[] WorkerID:Worker.001 IsExclusive:false PriorityLevel:0 Status:scheduled Inputs:[{Type:RoadSegment ID:urn:ngsi-ld:RoadSegment:testRoadSegment01 AttributeList:[]}] Outputs:[{Type:Out StreamID:Out.235109731.1 Annotations:[]}]}
INFO: 2022/10/08 17:50:10 task runnable =  true
INFO: 2022/10/08 17:50:10 to execute Task [ Task.StateEstimation.stateEstimation.235109731 ] to perform Operation [ MY_DOCKER_IMAGE:latest ] with parameters [ [] ]
INFO: 2022/10/08 17:50:10 operator image MY_DOCKER_IMAGE:latest exists locally
INFO: 2022/10/08 17:50:11  task Task.StateEstimation.stateEstimation.235109731  started within container = 550ade873571c5f5471d532afcf8fc59dcb4b2700a716514322ec56dd9da5ab8
INFO: 2022/10/08 17:50:11 subscribe its input streams
INFO: 2022/10/08 17:50:11 [Create subscription]  a7d23742-4731-11ed-9803-0242ac120008
DEBUG: 2022/10/08 17:50:11 executor.go:134: ===========subID =  a7d23742-4731-11ed-9803-0242ac120008
INFO: 2022/10/08 17:50:11 register this task

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions