Reputation: 2315
I'm using Cygnus to send data to cosmos. When there's a entity subscription to the context broker, in the JSON message you have to specify the event or trigger when the attribute of the entity have to be updated or sent to Cygnus. In the Cygnus documentation appears the following link:
It works in the release 0.13.0 of the Orion Context Broker?
First you have to create the entity and then create the notification? Or can you create the entity subscription and the notification in the same JSON message?
Can I see an example in JSON?
Upvotes: 3
Views: 565
Reputation: 12322
The general subscription/notification mechanism works with Cygnus in Orion 0.13.0 (and, in general, in any version, except maybe very ancient ones). The procedure will be, in general terms, assuming you have the Orion and Cygnus instances properly configured and running:
First, create a subscription at Orion, using as reference the host/port in which Cygnus is listening to. Example subscription:
{
"entities": [
{
"type": "Room",
"isPattern": "false",
"id": "Room1"
}
],
"attributes": [ ],
"reference": "cygnus_host:cygnus_port/cygnus_url",
"duration": "P1M",
"notifyConditions": [
{
"type": "ONCHANGE",
"condValues": [
"pressure",
"temperature"
]
}
]
}
Second, update at Orion any of the entity attributes at condValues in the subscription. Considering the above example, updates in "pressure" or "temperature" would case notifications. E.g. update on temperature:
{
"contextElements": [
{
"type": "Room",
"isPattern": "false",
"id": "Room1",
"attributes": [
{
"name": "temperature",
"type": "centigrade",
"value": "26.5"
}
]
}
]
}
Finally, the above update will cause a notification being sent to Cygnus with in sequence will persit in on the configured sink(s), e.g. Cosmos BigData, MySQL (from Cygnus 0.2.1) or CKAN (from Cygnus 0.3).
Additional observations:
cygnusagent.sources.http-source.port
in Cygnus configurationcygnusagent.sources.http-source.handler.notification_target
in Cygnuscygnusagent.sources.http-source.handler.orion_version
must match the version of Orion you are using (Cygnus 0.3 will not use any longer this mechanism).Please, have a look to Cygnus documentation for more details.
(NOTE: Include http:// before the reference element, I cannot add it myself due to StackOverFlow editing limitations)
Upvotes: 2