The notification.sh
appears to be a simulation of the result of an Orion Subscription - and therefore needs to be posted to the port Cygnus is listening on - which is usually localhost:5050
- assuming you are running Cygnus on localhost
.
Your couldn't connect to host
message indicates that either you have not started Cygnus on localhost
or you have configured an alternate port. Ensure you have used the environment variable CYGNUS_API_PORT=5080
somewhere or the agent.conf
file holds a line cygnus-ngsi.sources.http-source.port = 5050
The subscription it is simulating is supposed to be something along the lines of When X occurs send a notification to cygnus - Therefore I'm guessing that localhost:5050
is the location where Cygnus is supposed to be listening.
When setting up a REAL subscription and running Orion it needs to be something like:
curl -X POST \
'http://{{orion:port}}/v2/subscriptions/' \
-H 'Content-Type: application/json' \
-d '{
"description": "Notify Cygnus of all context changes",
"subject": {
"entities": [
{
"idPattern": ".*"
}
]
},
"notification": {
"http": {
"url": "http://{{cygnus:port}}/notify"
},
"attrsFormat": "legacy"
},
"throttling": 5
}'
Replace {{orion:port}}
and {{cyngnus:port}}
as necessary (this assumes you are not using a fiware-header
or fiware-servicepath
yet...)
You can then update an existing entity with the PATCH command:
curl -X PATCH \
'http://{{orion}}/v2/entities/<entity-id>/attrs' \
-H 'Content-Type: application/json' \
-d ' {
"price":{"type":"Integer", "value": 89}
}'
Obviously replace <entity-id>
and the -d
payload with your data.