'fiware-servicepath' header value does not

2019-08-13 06:48发布

问题:

Working on setting Cygnus as a sink to CKAN, and I get this error, what part of Cygnus setup is responsible for this( subscription, configuration ...)

cygnus_1  | time=2018-10-01T12:40:04.517Z | lvl=DEBUG | corr=1ea858dc-c577- 
11e8-b0fd-0242ac140003 | trans=5c553916-f5e6-4bbc-b98a-bcaba61a306c | 
srv=waste4think | subsrv=/room/test | comp=cygnus-ngsi | op=getEvents | 
msg=com.telefonica.iot.cygnus.handlers.NGSIRestHandler[320] : 
[NGSIRestHandler] Parsed NotifyContextRequest:{" 
subscriptionId":"5bb2153fd1bde90f8813b236","originator":"null","contextResponse    
s":[]}

I assume the error is connected to this contextResponses because it is empty, but I found no additional info what is causing this where I should look. And the error is not helping.

This is the more general question that issue since I cannot call this issue because I have no idea if it is me who is causing this or Cygnus to have indeed some problems.

Thanks.

回答1:

When setting up the subscription, Cygnus currently only accepts notifications in the older NGSI v1 format- the attrsFormat=legacy is therefore needed.

e.g.

curl -iX POST \
  'http://localhost:1026/v2/subscriptions' \
  -H 'Content-Type: application/json' \
  -H 'fiware-service: openiot' \
  -H 'fiware-servicepath: /' \
  -d '{
  "description": "Notify Cygnus of all context changes",
  "subject": {
    "entities": [
      {
        "idPattern": ".*"
      }
    ]
  },
  "notification": {
    "http": {
      "url": "http://cygnus:5050/notify"
    },
    "attrsFormat": "legacy"
  },
  "throttling": 5
}'

Further information about setting up subscriptions in Cygnus can be found in the Cygnus Tutorial