1
votes

I'm working with the Orion Context Broker and I'm trying to add a new subscription but I'm getting an error that the callback is missing even though I have provided one.

Here are the entities that I have

$ curl localhost:1026/v2/entities -s -S --header 'Accept: application/json' | python -mjson.tool
[
    {
        "id": "Room1",
        "pressure": {
            "metadata": {},
            "type": "Integer",
            "value": 720
        },
        "temperature": {
            "metadata": {},
            "type": "Float",
            "value": 23
        },
        "type": "Room"
    },
    {
        "id": "Room2",
        "pressure": {
            "metadata": {},
            "type": "Integer",
            "value": 711
        },
        "temperature": {
            "metadata": {},
            "type": "Float",
            "value": 21
        },
        "type": "Room"
    }
]

And here is the call to create a new subscription and subsequent error:

$ curl -v localhost:1026/v2/subscriptions -s -S --header 'Content-Type: application/json' \
>     -d @- <<EOF
> {
>   "description": "A subscription to get info about Room1",
>   "subject": {
>     "entities": [
>       {
>         "id": "Room1",
>         "type": "Room"
>       }
>     ],
>     "condition": {
>       "attributes": ["temperature"]
>     }
>   },
>   "notification": {
>     "http": {
>       "url": "http://localhost:1028/accumulate"
>     },
>     "attrs": [
>       "temperature",
>       "pressure"
>     ]
>   },
>   "expires": "2040-01-01T14:00:00.00Z",
>   "throttling": 5
> }
> EOF
* Hostname was NOT found in DNS cache
*   Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 1026 (#0)
> POST /v2/subscriptions HTTP/1.1
> User-Agent: curl/7.35.0
> Host: localhost:1026
> Accept: */*
> Content-Type: application/json
> Content-Length: 417
> 
* upload completely sent off: 417 out of 417 bytes
< HTTP/1.1 400 Bad Request
< Connection: Keep-Alive
< Content-Length: 58
< Content-Type: application/json
< Date: Mon, 08 Aug 2016 10:11:39 GMT
< 
* Connection #0 to host localhost left intact
{"error":"BadRequest","description":"callback is missing"}
1

1 Answers

1
votes

first of all, the request to create entities (POST /v2/entities) does not accept a vector of entities, but one single object. That request should give an error (unfortunately the broker responds with a JSON Parse Error which is not 100% correct). Change the request to create only Room1, and add another request if you want to create Room2 as well.
Now, the creation of the subscription looks good. I ran a test with your exact request and it worked just fine.
Now, to try to understand your problem, I ask you to add some information to the description of your question:

  • What version of the Orion context broker you are using? (use: curl localhost:1026/version) - you might want to update to a newer version, in case it is too old (1.2.0 is the latest release).
  • The traces that your broker produces at receiving the request to create the subscription. (use: cat /tmp/contextBroker.log). If you start the broker yourself, start it with all traces on (use options: -t 0-255 -logLevel DEBUG)

Lastly, sorry for the delay, vacation times ...