For Context Broker of kind "internal" and protocol "ngsi" it's possible to define an uri callback that is called automatically wherever some new data are published to the Context Broker. The uri is called Url Orion Callback and is avaialable on the tab Subscription whenever a context broker is created/edite
The payload sent to orion context broker is:
curl -v <ip_orion_broker>:<port_orion_broker>/v2/subscriptions -s -S --header 'Content-Type: application/json' -d @- <<EOF
{
"description": "<Name of the context broker>",
"subject": {
"entities": [
{
"idPattern": ".*",
"typePattern": ".*"
}
],
"condition": {
"attrs": []
}
},
"notification": {
"http": {
"url": "<Url Orion Callback>"
}
},
"expires": "2030-01-01T00:00:00.00Z"
}
EOF
The subscription_id is later on saved and shown to the user.
HTTP/1.1 201 Created
Connection: Keep-Alive
Content-Length: 0
Location: /v2/subscriptions/<subscription_id>
Fiware-Correlator: 9ac7bbba-2268-11e6-aaf0-d48564c29d20
Date: Wed, 25 May 2016 11:05:35 GMT
whenever the subscription failed, a special value is insert "FAILED" --> The automatic subscription failed (anyway the context broker is registered even if the subscripion failed)
whenever the subscription is null, means the automatic subscription is not available --> The automatic subscription is disabled
whenever the user change the <Url Orion Callback> or the <ip_orion_broker> or the <port_orion_broker>, the old subscription is removed and a new one is submitted
whenever the user delete the context broker, the subscription is removed
DELETE /v2/subscriptions/<subscription_id>