skip to Main Content

I don’t understand why Orion says to successfully send TrafficFlowObserved entity update but my service (dockerized) receives nothing.

I expect one of the following scenarios:

  • Orion prints an error message if it fails to contact service, assuming the url is incorrect, or
  • my service processes the request and prints the payload to the console.

But neither of these two scenarios happens.

Here’s the log from Orion:

2023-01-18 14:16:50 time=Wednesday 18 Jan 13:16:50 2023.790Z | lvl=TMP | corr=N/A | trans=1674046401-299-00000017019 | from=pending | srv=pending | subsrv=pending | comp=Orion | op=httpRequestSend.cpp[564]:httpRequestSendWithCurl | msg=Sending message 16973 to HTTP server: sending message of 994 bytes to HTTP server
2023-01-18 14:16:50 time=Wednesday 18 Jan 13:16:50 2023.792Z | lvl=INFO | corr=N/A | trans=1674046401-299-00000017019 | from=pending | srv=pending | subsrv=pending | comp=Orion | op=httpRequestSend.cpp[587]:httpRequestSendWithCurl | msg=Notification Successfully Sent to http://smart-vertical:9090/subscription/traffic-flow/observation?subscriptionId=urn:ngsi-ld:Subscription:59c301f4-972f-11ed-809c-0242ac190006

This is the code of resource in Quarkus that should receive the notification:

@Path("/subscription/traffic-flow")
public class TrafficFlowResource {
    @POST
    @Path("/observation")
    @Consumes(MediaType.APPLICATION_JSON)
    public void measurement(@QueryParam("subscriptionId") String id, Payload payload) {
        logger.info(payload);
    }
}

The Orion Context Broker subscription looks like following, but it’s done programmatically:

curl -L -X POST 'http://localhost:1026/ngsi-ld/v1/subscriptions/' 
    -H 'Content-Type: application/ld+json' 
    -H 'NGSILD-Tenant: openiot' 
    --data-raw '{
      "description": "Notify me of all traffic flow observation changes",
      "type": "Subscription",
      "entities": [{"type": "TrafficFlowObserved"}],
      "watchedAttributes": [
            "averageVehicleSpeed",
            "intensity",
            "occupancy",
            "levelOfService",
            "roadLoad",
            "saturationFlow"
      ],
      "notification": {
        "format": "keyValues",
        "endpoint": {
          "uri": "http://smart-vertical:9090/subscription/traffic-flow/observation",
          "accept": "application/json"
        }
      },
       "@context": "http://ld-context:80/ngsi-context.jsonld"
    }'

And this is the service configuration in docker:

smart-vertical:
    build:
        context: ./smart-vertical
        dockerfile: src/main/docker/Dockerfile.jvm
    restart: on-failure
    depends_on:
      - orion
    expose:
      - "9090"
    ports:
      - "9090:9090"
    environment:
      - CB_HOST=orion
      - CB_PORT=1026
      - SMART_VERTICAL_PORT=9090
      - SMART_VERTICAL_HOST=http://smart-vertical:9090/subscription
      - NGSI_CONTEXT_URL=http://ld-context:80/ngsi-context.jsonld

Orion and all services are on the same network created automatically by docker.

I have a feeling it’s an IP problem but without an error message I can’t be sure.

The tests I’ve done are to change the ip, so instead of using "smart-vertical" in docker-compose.yaml, I’ve tried "localhost", 172.30.0.8 (set by docker), 0.0.0.0 but the situation gets worse because I get the following results:

2023-01-18 14:55:44 time=Wednesday 18 Jan 13:55:44 2023.079Z | lvl=ERROR | corr=N/A | trans=1674050062-123-00000000379 | from=pending | srv=pending | subsrv=pending | comp=Orion | op=httpRequestSend.cpp[573]:httpRequestSendWithCurl | msg=curl_easy_perform failed: 7

or

2023-01-18 15:07:43 time=Wednesday 18 Jan 14:07:43 2023.747Z | lvl=ERROR | corr=N/A | trans=1674050827-980-00000000194 | from=pending | srv=pending | subsrv=pending | comp=Orion | op=httpRequestSend.cpp[573]:httpRequestSendWithCurl | msg=curl_easy_perform failed: 28

From the Orion implementation (github) I saw that:

  • 7 stands for message size too large
  • 28 should be 2+8?? where 2 stands for "Invalid IP" and 8 stands for "Unable to initialize libcurl (NOTE: only possible if actual curl is not provided as first argument)".

Quarkus uses Vertx and by default Vertx uses its own DNS, could this be the problem? But I don’t understand why with this setting

SMART_VERTICAL_HOST=http://smart-vertical:9090/subscription

I don’t have IP problems but I still don’t receive anything.

2

Answers


  1. Chosen as BEST ANSWER

    I confirm it was a network problem. I solved by setting hostname of smart-vertical service and it works! For completeness, below is the part of docker compose affected by the changes:

    smart-vertical:
        build:
            context: ./smart-vertical
            dockerfile: src/main/docker/Dockerfile.jvm
        hostname: smart-vertical
    

  2. Yes, it seems like you have a network problem. 28 is 28, not 2+8 nor 4*7 nor anything like that. libcurl error 28 is "CURLE_OPERATION_TIMEDOUT", so, I’d suggest you look at network issues. And yes, the error message could be clearer, but, there are literally thousands or possible errors inside the broker. Not easy to make them all 100% perfect.
    About "error responses": if the update/creation that provoked the notification works just fine, the broker regards it as a success. There’s room for improvement here, but that’s how it works right now. Remember, the notification is merely a "biproduct" of the update/create operation.
    So, check your network and if you still have a problem, post again and my team will try to help you out to fix your problem.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search