2

Based on this post (Fiware - Context broker: Issue with NGSIv2 subscriptions) a few months ago it was under discussion whether Cygnus supported NGSIv2 or not. It was commented that the issue were schedule but not yet implemented.

Question: Is it implemented already? how can we know?

My confusion reminds because when creating a subscription based on NGSIv2, and outcome of successfully created message pop up (i.e., 201), but still cannot monitor my subscription record into Orion.

I'm creating my subscription like this:

Content-Type:application/json
Accept: application/json
Fiware-Service: test
Fiware-ServicePath: /device

{ 
      "description": "One subscription to rule them all",  
      "subject": {    
        "entities": [ {        
          "idPattern": ".*",        
          "type": "smarthphone" } ],    
        "condition": {      
          "attrs": [ "battery" ], 
          "expression": { "q": "battery!=0" }    
          }
        },  
        "notification": {    
        "http": {      
          "url": "<MY COSMOS IP>:5050/notify" },    
          "attrs": [ "battery" ]  
        },  
        "expires": "2120-04-05T14:00:00.00Z",  
        "throttling": 1
    }

And this is what I get:

Connection: Keep-Alive
Content-Length: 0
Location: /v2/subscriptions/587c62fcfebdbe5f74bad77b
Fiware-Correlator: f9a96bd0-dbb1-11e6-93ea-0242ac110004
Date: Mon, 16 Jan 2017 06:06:52 GMT

But when I retrieve such subscription it does't show:

.../v2/subscriptions/587c62fcfebdbe5f74bad77b

Any hint of what am I doing wrong?

Community
  • 1
  • 1
netzahdzc
  • 237
  • 1
  • 10
  • Btw, I have also tried what is recommended in this site (http://fiware-cygnus.readthedocs.io/en/1.5.0/cygnus-common/installation_and_administration_guide/install_with_docker/) but still no signals of live with my subscription. I'm holding Cygnus version 1.6.0 which implies it should not be the problem, right? – netzahdzc Jan 16 '17 at 18:14
  • What is the message you get when you try to retrieve the subscription with `.../v2/subscriptions/587c62fcfebdbe5f74bad77b` ? – Dalton Cézane Jan 25 '17 at 04:10
  • I got no error, it was showed an empty array with no subscription record – netzahdzc Jan 26 '17 at 02:32
  • Do you include the `Fiware-Service: test` and `Fiware-ServicePath: /device` headers in your request? – Dalton Cézane Jan 26 '17 at 14:35
  • Cool @Dalton, I was omitting those values. thanks!! – netzahdzc Jan 28 '17 at 19:42
  • Does these headers solve your problem? Good! – Dalton Cézane Jan 28 '17 at 20:03

2 Answers2

1

"Cygnus does not support NGSIv2" means no NGSIv2 notifications are accepted in the service port (by default, TCP/5050). For the time being, only NGSIv1 notifications are accepted.

Nevertheless, what we have added to Cygnus API is a convenience operation about subscribing to Orion, either using NGSIv1 or NGSIv2 subscription format. I guess that's what you have tested (without success). Internally, such an operation implements just a forwarding (to the given Orion endpoint) of the given subscription. If Cygnus API says everything went OK, it is because Orion said everuything went OK.

Anyway, I'll edit this post once I perform a test by my side. In the meantime, you can ignore Cygnus API and use Orion API directly.

frb
  • 3,738
  • 2
  • 21
  • 51
0

If you have entities created with headers Fiware-Service: test and Fiware-ServicePath: /device , you also need to use these headers in your requests (GET, PUT, etc.).

Dalton Cézane
  • 3,672
  • 2
  • 35
  • 60
  • btw, no sure if this is should be another question but. After creating my subscription, it shows an active status. But, after posting a json object, my subscription turns its status to "status": "failed" . Do you know what could be happening ? – netzahdzc Jan 28 '17 at 20:34
  • Yes. Its better to create another question, giving the details of the problem. – Dalton Cézane Jan 28 '17 at 20:36
  • ok, then please don't go to sleep, I will prepare the question :D – netzahdzc Jan 28 '17 at 20:38
  • I have created the other question, hopefully you know how to tackle it: http://stackoverflow.com/questions/41914762/subscription-status-change-after-post – netzahdzc Jan 28 '17 at 21:00