Reputation: 807
What do I need to put in the reference attribute?
I'm using two forms, and the two are bad for Orion Context Broker
:
URL url = new URL("http://130.206.127.23:1026/ngsi10/notifyContext");
//String url = "http://localhost:1028/accumulate";
cabecera.put("reference", ""+url);
With this code, I'm generating the next JSON String
for the reference
attribute
...."reference":"http:\/\/130.206.127.23:1026\/ngsi10\/notifyContext",...
And this is the response of OCB
<subscribeContextResponse>
<subscribeError>
<errorCode>
<code>400</code>
<reasonPhrase>Bad Request</reasonPhrase>
<details>JSON Parse Error: <unspecified file>(1): invalid escape sequence</details>
</errorCode>
</subscribeError>
</subscribeContextResponse>
Also related to this parameter,do I need a program in execution in a server to receive the information about my subscription?
Can I get a program from Orion Context Broker resources to do this task?
The following is my JSON to call the service, but I'm not sure about the reference attribute. I want to send a subscription to my Orion Context Broker instance. I'm sending this JSON:
{
"duration": "P1M",
"reference": "http://130.206.127.23:1026/ngsi10/notifyContext",
"notifyConditions": [
{
"condValues": [
"PT10s"
],
"type": "ONTIMEINTERVAL"
}
],
"entities": [
{
"id": "1.0",
"type": "Capsule",
"isPattern": "false"
}
],
"attributes": [
"temperature"
]
}
Thanks in advance.
Upvotes: 1
Views: 336
Reputation: 12294
The reference element is described in the Orion User Manual:
The callback URL to send notifications is defined with the reference element.
Thus, if your reference is http://130.206.127.23:1026/ngsi10/notifyContext
as shown in your example, you should have a REST server listening at host 130.206.127.23 port 1026, able to receive notifications in the /ngsi10/notifyContext
path. Note that your CB (I mean, the one to which you are sending the subscribeContext request) is the actor that sends notification, not the actor that receives them, so it must not run at 130.206.127.23:1026.
You can implement the notifications receiver program in any programming language that you want (as long as it implements the required REST server interface). You can have a look to the accumulator-server.py, which is a "dummy" notification receiver example implemented in Python, used for testing.
Upvotes: 1