Uploaded image for project: 'Help-Desk'
  1. Help-Desk
  2. HELP-15474

[fiware-stackoverflow] Fiware orion subscription sending empty body

    Details

      Description

      Created question in FIWARE Q/A platform on 20-02-2019 at 04:02
      Please, ANSWER this question AT https://stackoverflow.com/questions/54778164/fiware-orion-subscription-sending-empty-body

      Question:
      Fiware orion subscription sending empty body

      Description:
      My setup:
      docker-compose:

      version: "3.1"
      services:
      mongo-db:
      image: mongo:3.6
      hostname: mongo-db
      container_name: db-mongo
      expose:

      • "27017"
        ports:
      • "27017:27017"
        networks:
      • default
        command: --bind_ip_all --smallfiles
        volumes:
      • mongo-db:/data

      orion:
      image: fiware/orion:2.1.0
      hostname: orion
      container_name: fiware-orion
      depends_on:

      • mongo-db
        networks:
      • default
        expose:
      • "1026"
        ports:
      • "1026:1026"
        command: -dbhost mongo-db -logLevel DEBUG
        logging:
        driver: none
        healthcheck:
        test: curl --fail -s http://localhost:1026/version || exit 1

      iot-agent:
      image: fiware/iotagent-ul:latest
      hostname: iot-agent
      container_name: fiware-iot-agent
      depends_on:

      • mongo-db
        networks:
      • default
        expose:
      • "4041"
      • "7896"
        ports:
      • "4041:4041"
      • "7896:7896"
        logging:
        driver: none
        environment:
      • "IOTA_CB_HOST=orion"
      • "IOTA_CB_PORT=1026"
      • "IOTA_NORTH_PORT=4041"
      • "IOTA_REGISTRY_TYPE=mongodb"
      • "IOTA_LOG_LEVEL=DEBUG"
      • "IOTA_TIMESTAMP=true"
      • "IOTA_MONGO_HOST=mongo-db"
      • "IOTA_MONGO_PORT=27017"
      • "IOTA_MONGO_DB=iotagentul"
      • "IOTA_HTTP_PORT=7896"
      • "IOTA_PROVIDER_URL=http://iot-agent:4041"

      networks:
      default:
      ipam:
      config:

      • subnet: 172.18.1.0/24

      volumes:
      mongo-db: ~

      context:

      curl -iX POST \
      'http://localhost:1026/v2/op/update' \
      -H 'Content-Type: application/json' \
      -H 'fiware-service: didi' \
      -H 'fiware-servicepath: /' \
      -d '{
      "actionType":"APPEND",
      "entities":[
      {
      "id":"urn:ngsi-ld:Furniture:unit001", "type":"Furniture",
      "name":

      { "type":"Text", "value":"Bürostuhl" }

      ,
      "price":

      { "type":"Integer", "value":404.40 }

      },
      {
      "id":"urn:ngsi-ld:Furniture:unit002", "type":"Furniture",
      "name":

      { "type":"Text", "value":"Bürotisch" }

      ,
      "price":

      { "type":"Integer", "value":203.40 }

      },
      {
      "id":"urn:ngsi-ld:DeliverService:unit001", "type":"ServiceProvider",
      "name":

      { "type":"Text", "value":"trinkajo" }

      ,
      "address":{
      "type":"PostalAddress",
      "value":

      { "telephoneNumber":"43q4q53", "internetAdresse":"https://www.345345.de/" }

      }
      },
      {
      "id":"urn:ngsi-ld:BottleCounter:001", "type":"BottleCounter",
      "name":

      { "type":"Text", "value":"Wasserflaschenzähler" }

      ,
      "numberOfBottles":

      {"type":"Integer", "value":645}

      }
      ]
      }'

      curl -iX POST \
      'http://localhost:1026/v2/op/update' \
      -H 'Content-Type: application/json' \
      -H 'fiware-service: didi' \
      -H 'fiware-servicepath: /' \
      -d '{
      "actionType":"APPEND",
      "entities":[
      {
      "id":"urn:ngsi-ld:Furniture:unit001", "type":"Furniture",
      "refOffice":

      { "type": "Relationship", "value": "urn:ngsi-ld:Office:001" }

      },
      {
      "id":"urn:ngsi-ld:Furniture:unit002", "type":"Furniture",
      "refOffice":

      { "type": "Relationship", "value": "urn:ngsi-ld:Office:001" }


      },
      {
      "id":"urn:ngsi-ld:DeliverService:unit001", "type":"ServiceProvider",
      "refOffice":

      { "type": "Relationship", "value": "urn:ngsi-ld:Office:001" }


      }
      ]
      }'
      curl -iX POST \
      'http:

      //localhost:1026/v2/op/update' \
      -H 'Content-Type: application/json' \
      -H 'fiware-service: didi' \
      -H 'fiware-servicepath: /' \
      -d '{
      "actionType":"APPEND",
      "entities":[
      {
      "id":"urn:ngsi-ld:Office:001", "type" : "Office",
      "name":

      { "type":"Text", "value":"didi-Hamburg" }

      ,
      "sizeInM2":

      { "type":"Integer", "value":60 }

      ,
      "address":{
      "type":"PostalAddress",
      "value":

      { "country":"Germany", "locality":"sdfg", "street":"sdfg", "houseNumber" : "34", "postalCode":"34533" }

      }
      }
      ]
      }'

      curl -iX POST \
      'http://localhost:4041/iot/services' \
      -H 'Content-Type: application/json' \
      -H 'fiware-service: didi' \
      -H 'fiware-servicepath: /' \
      -d '{
      "services": [

      { "apikey": "4jggokgpepnvsb2uv4s40d59ov", "cbroker": "http://orion:1026", "entity_type": "Thing", "resource": "/iot/d" }

      ]
      }'
      curl -G -X GET \
      'http://localhost:1026/v2/entities/urn:ngsi-ld:Office:001' \
      -H 'fiware-service: didi' \
      -H 'fiware-servicepath: /' \
      -d 'type=Office' \
      -d 'options=keyValues' | json_pp

      curl -iX POST \
      'http://localhost:4041/iot/devices' \
      -H 'Content-Type: application/json' \
      -H 'fiware-service: didi' \
      -H 'fiware-servicepath: /' \
      -d '{
      "devices": [
      {
      "device_id": "bottleCounter001",
      "entity_name": "urn:ngsi-ld:BottleCounter:001",
      "entity_type": "BottleCounter",
      "timezone": "Europe/Berlin",
      "attributes": [

      { "object_id": "c", "name": "numberOfBottles", "type": "Integer" }

      ],
      "static_attributes": [

      { "name":"refOffice", "type": "Relationship", "value": "urn:ngsi-ld:Office:001"}

      ]
      }
      ]
      }'

      The subscription:

      curl -iX POST \
      --url 'http://localhost:1026/v2/subscriptions' \
      --header 'Content-Type: application/json' \
      -H 'fiware-service: didi' \
      -H 'fiware-servicepath: /' \
      --data '{
      "description": "Notify me of low stock in Office 001",
      "subject": {
      "entities": [

      {"idPattern": ".*", "type" : "BottleCounter"}

      ],
      "condition": {
      "attrs": ["numberOfBottles"],
      "expression":

      {"q": "numberOfBottles<10;refOffice==urn:ngsi-ld:Office:001"}

      }
      },
      "notification": {
      "http":

      { "url": "http://delivery:8080/subscription/office" }

      }
      }'

      I have several problems:

      With the condition numberOfBottles<10 the subscription never get triggered. When I use something like numberOfBottles!=10 it is working
      There is only an empty body sent to the url http://delivery:8080/subscription/office

      A bonus question: if I can fix the first issues:
      Is there a way to send the attribute address from urn:ngsi-ld:DeliverService:unit001 to the url http://delivery:8080/subscription/office when the subscription get triggered?

        Activity

        fla Fernando Lopez made changes -
        Fix Version/s 2021 [ 12600 ]
        backlogmanager Backlog Manager made changes -
        Resolution Done [ 10000 ]
        Status Answered [ 10104 ] Closed [ 6 ]
        backlogmanager Backlog Manager made changes -
        Status In Progress [ 3 ] Answered [ 10104 ]
        backlogmanager Backlog Manager made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        fla Fernando Lopez made changes -
        HD-Enabler Orion [ 10875 ]
        Description
        Created question in FIWARE Q/A platform on 20-02-2019 at 04:02
        {color: red}Please, ANSWER this question AT{color} https://stackoverflow.com/questions/54778164/fiware-orion-subscription-sending-empty-body


        +Question:+
        Fiware orion subscription sending empty body

        +Description:+
        My setup:
        docker-compose:

        version: "3.1"
        services:
          mongo-db:
            image: mongo:3.6
            hostname: mongo-db
            container_name: db-mongo
            expose:
              - "27017"
            ports:
              - "27017:27017"
            networks:
              - default
            command: --bind_ip_all --smallfiles
            volumes:
              - mongo-db:/data

          orion:
            image: fiware/orion:2.1.0
            hostname: orion
            container_name: fiware-orion
            depends_on:
              - mongo-db
            networks:
              - default
            expose:
              - "1026"
            ports:
              - "1026:1026"
            command: -dbhost mongo-db -logLevel DEBUG
            logging:
              driver: none
            healthcheck:
              test: curl --fail -s http://localhost:1026/version || exit 1

          iot-agent:
            image: fiware/iotagent-ul:latest
            hostname: iot-agent
            container_name: fiware-iot-agent
            depends_on:
                - mongo-db
            networks:
                - default
            expose:
                - "4041"
                - "7896"
            ports:
                - "4041:4041"
                - "7896:7896"
            logging:
              driver: none
            environment:
                - "IOTA_CB_HOST=orion"
                - "IOTA_CB_PORT=1026"
                - "IOTA_NORTH_PORT=4041"
                - "IOTA_REGISTRY_TYPE=mongodb"
                - "IOTA_LOG_LEVEL=DEBUG"
                - "IOTA_TIMESTAMP=true"
                - "IOTA_MONGO_HOST=mongo-db"
                - "IOTA_MONGO_PORT=27017"
                - "IOTA_MONGO_DB=iotagentul"
                - "IOTA_HTTP_PORT=7896"
                - "IOTA_PROVIDER_URL=http://iot-agent:4041"


        networks:
          default:
            ipam:
              config:
                - subnet: 172.18.1.0/24

        volumes:
          mongo-db: ~


        context:

        curl -iX POST \
          'http://localhost:1026/v2/op/update&#39; \
          -H 'Content-Type: application/json' \
          -H 'fiware-service: didi' \
          -H 'fiware-servicepath: /' \
          -d '{
          "actionType":"APPEND",
          "entities":[
            {
              "id":"urn:ngsi-ld:Furniture:unit001", "type":"Furniture",
              "name":{
                "type":"Text", "value":"Bürostuhl"
              },
              "price":{
                "type":"Integer", "value":404.40
              }
            },
            {
              "id":"urn:ngsi-ld:Furniture:unit002", "type":"Furniture",
              "name":{
                "type":"Text", "value":"Bürotisch"
              },
              "price":{
                "type":"Integer", "value":203.40
              }
            },
            {
              "id":"urn:ngsi-ld:DeliverService:unit001", "type":"ServiceProvider",
              "name":{
                "type":"Text", "value":"trinkajo"
              },
               "address":{
                    "type":"PostalAddress",
                    "value":{
                       "telephoneNumber":"43q4q53",
                       "internetAdresse":"https://www.345345.de/"
                    }
                 }
            },
            {
              "id":"urn:ngsi-ld:BottleCounter:001", "type":"BottleCounter",
              "name":{
                "type":"Text", "value":"Wasserflaschenzähler"
              },
              "numberOfBottles": {"type":"Integer", "value":645}
            }
          ]
        }'




        curl -iX POST \
          'http://localhost:1026/v2/op/update&#39; \
          -H 'Content-Type: application/json' \
          -H 'fiware-service: didi' \
          -H 'fiware-servicepath: /' \
          -d '{
          "actionType":"APPEND",
          "entities":[
            {
              "id":"urn:ngsi-ld:Furniture:unit001", "type":"Furniture",
              "refOffice": {
                "type": "Relationship",
                "value": "urn:ngsi-ld:Office:001"
              }
            },
            {
              "id":"urn:ngsi-ld:Furniture:unit002", "type":"Furniture",
              "refOffice": {
                "type": "Relationship",
                "value": "urn:ngsi-ld:Office:001"

              }
            },
            {
              "id":"urn:ngsi-ld:DeliverService:unit001", "type":"ServiceProvider",
              "refOffice": {
                "type": "Relationship",
                "value": "urn:ngsi-ld:Office:001"

              }
            }
          ]
        }'
        curl -iX POST \
          'http:




        //localhost:1026/v2/op/update' \
          -H 'Content-Type: application/json' \
          -H 'fiware-service: didi' \
          -H 'fiware-servicepath: /' \
          -d '{
           "actionType":"APPEND",
           "entities":[
              {
                 "id":"urn:ngsi-ld:Office:001", "type" : "Office",
                 "name":{
                    "type":"Text",
                    "value":"didi-Hamburg"
                 },
                 "sizeInM2":{
                    "type":"Integer",
                    "value":60
                 },
                 "address":{
                    "type":"PostalAddress",
                    "value":{
                       "country":"Germany",
                       "locality":"sdfg",
                       "street":"sdfg",
                       "houseNumber" : "34",
                       "postalCode":"34533"
                    }
                 }
              }
           ]
        }'


        curl -iX POST \
          'http://localhost:4041/iot/services&#39; \
          -H 'Content-Type: application/json' \
          -H 'fiware-service: didi' \
          -H 'fiware-servicepath: /' \
          -d '{
         "services": [
           {
             "apikey": "4jggokgpepnvsb2uv4s40d59ov",
             "cbroker": "http://orion:1026",
             "entity_type": "Thing",
             "resource": "/iot/d"
           }
         ]
        }'
        curl -G -X GET \
          'http://localhost:1026/v2/entities/urn:ngsi-ld:Office:001&#39; \
          -H 'fiware-service: didi' \
          -H 'fiware-servicepath: /' \
          -d 'type=Office' \
          -d 'options=keyValues' | json_pp

        curl -iX POST \
          'http://localhost:4041/iot/devices&#39; \
          -H 'Content-Type: application/json' \
          -H 'fiware-service: didi' \
          -H 'fiware-servicepath: /' \
          -d '{
         "devices": [
           {
             "device_id": "bottleCounter001",
             "entity_name": "urn:ngsi-ld:BottleCounter:001",
             "entity_type": "BottleCounter",
             "timezone": "Europe/Berlin",
             "attributes": [
               { "object_id": "c", "name": "numberOfBottles", "type": "Integer" }
             ],
             "static_attributes": [
               { "name":"refOffice", "type": "Relationship", "value": "urn:ngsi-ld:Office:001"}
             ]
           }
         ]
        }'


        The subscription:

        curl -iX POST \
          --url 'http://localhost:1026/v2/subscriptions&#39; \
          --header 'Content-Type: application/json' \
          -H 'fiware-service: didi' \
          -H 'fiware-servicepath: /' \
          --data '{
          "description": "Notify me of low stock in Office 001",
          "subject": {
            "entities": [{"idPattern": ".*", "type" : "BottleCounter"}],
            "condition": {
              "attrs": ["numberOfBottles"],
              "expression": {"q": "numberOfBottles&lt;10;refOffice==urn:ngsi-ld:Office:001"}
            }
          },
          "notification": {
            "http": {
              "url": "http://delivery:8080/subscription/office"
            }
          }
        }'


        I have several problems:


        With the condition numberOfBottles&lt;10 the subscription never get triggered. When I use something like numberOfBottles!=10 it is working
        There is only an empty body sent to the url http://delivery:8080/subscription/office


        A bonus question: if I can fix the first issues:
        Is there a way to send the attribute address from urn:ngsi-ld:DeliverService:unit001 to the url http://delivery:8080/subscription/office when the subscription get triggered?
        Created question in FIWARE Q/A platform on 20-02-2019 at 04:02
        {color: red}Please, ANSWER this question AT{color} https://stackoverflow.com/questions/54778164/fiware-orion-subscription-sending-empty-body


        +Question:+
        Fiware orion subscription sending empty body

        +Description:+
        My setup:
        docker-compose:

        version: "3.1"
        services:
          mongo-db:
            image: mongo:3.6
            hostname: mongo-db
            container_name: db-mongo
            expose:
              - "27017"
            ports:
              - "27017:27017"
            networks:
              - default
            command: --bind_ip_all --smallfiles
            volumes:
              - mongo-db:/data

          orion:
            image: fiware/orion:2.1.0
            hostname: orion
            container_name: fiware-orion
            depends_on:
              - mongo-db
            networks:
              - default
            expose:
              - "1026"
            ports:
              - "1026:1026"
            command: -dbhost mongo-db -logLevel DEBUG
            logging:
              driver: none
            healthcheck:
              test: curl --fail -s http://localhost:1026/version || exit 1

          iot-agent:
            image: fiware/iotagent-ul:latest
            hostname: iot-agent
            container_name: fiware-iot-agent
            depends_on:
                - mongo-db
            networks:
                - default
            expose:
                - "4041"
                - "7896"
            ports:
                - "4041:4041"
                - "7896:7896"
            logging:
              driver: none
            environment:
                - "IOTA_CB_HOST=orion"
                - "IOTA_CB_PORT=1026"
                - "IOTA_NORTH_PORT=4041"
                - "IOTA_REGISTRY_TYPE=mongodb"
                - "IOTA_LOG_LEVEL=DEBUG"
                - "IOTA_TIMESTAMP=true"
                - "IOTA_MONGO_HOST=mongo-db"
                - "IOTA_MONGO_PORT=27017"
                - "IOTA_MONGO_DB=iotagentul"
                - "IOTA_HTTP_PORT=7896"
                - "IOTA_PROVIDER_URL=http://iot-agent:4041"


        networks:
          default:
            ipam:
              config:
                - subnet: 172.18.1.0/24

        volumes:
          mongo-db: ~


        context:

        curl -iX POST \
          'http://localhost:1026/v2/op/update&#39; \
          -H 'Content-Type: application/json' \
          -H 'fiware-service: didi' \
          -H 'fiware-servicepath: /' \
          -d '{
          "actionType":"APPEND",
          "entities":[
            {
              "id":"urn:ngsi-ld:Furniture:unit001", "type":"Furniture",
              "name":{
                "type":"Text", "value":"Bürostuhl"
              },
              "price":{
                "type":"Integer", "value":404.40
              }
            },
            {
              "id":"urn:ngsi-ld:Furniture:unit002", "type":"Furniture",
              "name":{
                "type":"Text", "value":"Bürotisch"
              },
              "price":{
                "type":"Integer", "value":203.40
              }
            },
            {
              "id":"urn:ngsi-ld:DeliverService:unit001", "type":"ServiceProvider",
              "name":{
                "type":"Text", "value":"trinkajo"
              },
               "address":{
                    "type":"PostalAddress",
                    "value":{
                       "telephoneNumber":"43q4q53",
                       "internetAdresse":"https://www.345345.de/"
                    }
                 }
            },
            {
              "id":"urn:ngsi-ld:BottleCounter:001", "type":"BottleCounter",
              "name":{
                "type":"Text", "value":"Wasserflaschenzähler"
              },
              "numberOfBottles": {"type":"Integer", "value":645}
            }
          ]
        }'




        curl -iX POST \
          'http://localhost:1026/v2/op/update&#39; \
          -H 'Content-Type: application/json' \
          -H 'fiware-service: didi' \
          -H 'fiware-servicepath: /' \
          -d '{
          "actionType":"APPEND",
          "entities":[
            {
              "id":"urn:ngsi-ld:Furniture:unit001", "type":"Furniture",
              "refOffice": {
                "type": "Relationship",
                "value": "urn:ngsi-ld:Office:001"
              }
            },
            {
              "id":"urn:ngsi-ld:Furniture:unit002", "type":"Furniture",
              "refOffice": {
                "type": "Relationship",
                "value": "urn:ngsi-ld:Office:001"

              }
            },
            {
              "id":"urn:ngsi-ld:DeliverService:unit001", "type":"ServiceProvider",
              "refOffice": {
                "type": "Relationship",
                "value": "urn:ngsi-ld:Office:001"

              }
            }
          ]
        }'
        curl -iX POST \
          'http:




        //localhost:1026/v2/op/update' \
          -H 'Content-Type: application/json' \
          -H 'fiware-service: didi' \
          -H 'fiware-servicepath: /' \
          -d '{
           "actionType":"APPEND",
           "entities":[
              {
                 "id":"urn:ngsi-ld:Office:001", "type" : "Office",
                 "name":{
                    "type":"Text",
                    "value":"didi-Hamburg"
                 },
                 "sizeInM2":{
                    "type":"Integer",
                    "value":60
                 },
                 "address":{
                    "type":"PostalAddress",
                    "value":{
                       "country":"Germany",
                       "locality":"sdfg",
                       "street":"sdfg",
                       "houseNumber" : "34",
                       "postalCode":"34533"
                    }
                 }
              }
           ]
        }'


        curl -iX POST \
          'http://localhost:4041/iot/services&#39; \
          -H 'Content-Type: application/json' \
          -H 'fiware-service: didi' \
          -H 'fiware-servicepath: /' \
          -d '{
         "services": [
           {
             "apikey": "4jggokgpepnvsb2uv4s40d59ov",
             "cbroker": "http://orion:1026",
             "entity_type": "Thing",
             "resource": "/iot/d"
           }
         ]
        }'
        curl -G -X GET \
          'http://localhost:1026/v2/entities/urn:ngsi-ld:Office:001&#39; \
          -H 'fiware-service: didi' \
          -H 'fiware-servicepath: /' \
          -d 'type=Office' \
          -d 'options=keyValues' | json_pp

        curl -iX POST \
          'http://localhost:4041/iot/devices&#39; \
          -H 'Content-Type: application/json' \
          -H 'fiware-service: didi' \
          -H 'fiware-servicepath: /' \
          -d '{
         "devices": [
           {
             "device_id": "bottleCounter001",
             "entity_name": "urn:ngsi-ld:BottleCounter:001",
             "entity_type": "BottleCounter",
             "timezone": "Europe/Berlin",
             "attributes": [
               { "object_id": "c", "name": "numberOfBottles", "type": "Integer" }
             ],
             "static_attributes": [
               { "name":"refOffice", "type": "Relationship", "value": "urn:ngsi-ld:Office:001"}
             ]
           }
         ]
        }'


        The subscription:

        curl -iX POST \
          --url 'http://localhost:1026/v2/subscriptions&#39; \
          --header 'Content-Type: application/json' \
          -H 'fiware-service: didi' \
          -H 'fiware-servicepath: /' \
          --data '{
          "description": "Notify me of low stock in Office 001",
          "subject": {
            "entities": [{"idPattern": ".*", "type" : "BottleCounter"}],
            "condition": {
              "attrs": ["numberOfBottles"],
              "expression": {"q": "numberOfBottles&lt;10;refOffice==urn:ngsi-ld:Office:001"}
            }
          },
          "notification": {
            "http": {
              "url": "http://delivery:8080/subscription/office"
            }
          }
        }'


        I have several problems:


        With the condition numberOfBottles&lt;10 the subscription never get triggered. When I use something like numberOfBottles!=10 it is working
        There is only an empty body sent to the url http://delivery:8080/subscription/office


        A bonus question: if I can fix the first issues:
        Is there a way to send the attribute address from urn:ngsi-ld:DeliverService:unit001 to the url http://delivery:8080/subscription/office when the subscription get triggered?
        fla Fernando Lopez made changes -
        Assignee Jose Manuel Cantera [ jmcantera ]
        backlogmanager Backlog Manager made changes -
        Field Original Value New Value
        Component/s FIWARE-TECH-HELP [ 10278 ]
        backlogmanager Backlog Manager created issue -

          People

          • Assignee:
            jmcantera Jose Manuel Cantera
            Reporter:
            backlogmanager Backlog Manager
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: