Recall that our program's entrypoint finishes with initializing the app struct and calling the
app.Start(ctx) function. The
Start function is a place where we start the application's lifecycle.
Start function is composed of the following parts:
- Start receiving configuration notifications with
receiveConfigNotificationsfunction. In this function we:
- Start Configuration Stream
- Receive notifications from the stream
- When the configuration notification is received, unmarshal received config into the
- Upon "commit.end" marker seen in the config notification, signal that the whole config set has been read by sending a message to the
- Process the configuration by computing the
- Update application's state by with
- Stop the application when the context is cancelled
Time to have a closer look at the first part of the
Start function - receiving configuration notifications with
go a.receiveConfigNotifications(ctx) function.