Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EdgeHub awaits for Twin in non-MQTT broker scenario (#4084) #4129

Merged

Commits on Dec 18, 2020

  1. EdgeHub awaits for Twin in non-MQTT broker scenario (Azure#4084)

    TL;DR
    Currently the protocol head could start up before the route configuration is setup on edgeHub. This causes the messages which are sent before the route is config to be permanently lost.
    
    Background:
    Historically, the edgeHub tries to download its twin to get the routings before it starts up the protocol heads, then it was waiting till the twin arrived, then it had the routings, then it started the protocol heads. With the new broker and nested scenario, the problem is that it needs the protocol heads up to get the twin. The twin comes through the MQTT broker, and one of the protocol heads handle the messages from the broker. The problem arises because protocol heads are up, but no twin available yet.
    
    Fix:
    If the upstream is not via MQTT broker, then await the twin task; otherwise, let it runs.
    
    Todo:
    This code change does not handle the scenario:
    IoTHub <--MQTT/BRIDGE-- EdgeDevice <--AMQP-- DeviceA
    
    Since we are not waiting on the configUpdate (that would be a dead lock, because configUpdate() needs the new mqtt/broker to be started), the code goes ahead and starts every protocol head i.e. AMQP listener for connecting clients. This can cause an AMQP message to be sent (into the void) before a route is setup on the DeviceA.
    yophilav committed Dec 18, 2020
    Configuration menu
    Copy the full SHA
    93515ab View commit details
    Browse the repository at this point in the history