From 4baa575344bf08bfdf25013bd4353a9d4a1c3feb Mon Sep 17 00:00:00 2001 From: Jim Bennett Date: Fri, 25 Jun 2021 13:08:37 -0700 Subject: [PATCH] Notes on consumer groups and not running the event monitor at the same time --- 2-farm/lessons/4-migrate-your-plant-to-the-cloud/README.md | 2 ++ 2-farm/lessons/5-migrate-application-to-the-cloud/README.md | 6 +++++- 3-transport/lessons/2-store-location-data/README.md | 3 +++ 3-transport/lessons/4-geofences/README.md | 2 ++ 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/2-farm/lessons/4-migrate-your-plant-to-the-cloud/README.md b/2-farm/lessons/4-migrate-your-plant-to-the-cloud/README.md index ea4a5ba0..28361f07 100644 --- a/2-farm/lessons/4-migrate-your-plant-to-the-cloud/README.md +++ b/2-farm/lessons/4-migrate-your-plant-to-the-cloud/README.md @@ -384,6 +384,8 @@ For now, you won't be updating your server code. Instead you can use the Azure C The time values in the annotations are in [UNIX time](https://wikipedia.org/wiki/Unix_time), representing the number of seconds since midnight on 1st January 1970. + Exit the event monitor when you are done. + ### Task - control your IoT device You can also use the Azure CLI to call direct methods on your IoT device. diff --git a/2-farm/lessons/5-migrate-application-to-the-cloud/README.md b/2-farm/lessons/5-migrate-application-to-the-cloud/README.md index f92b13e9..3a455971 100644 --- a/2-farm/lessons/5-migrate-application-to-the-cloud/README.md +++ b/2-farm/lessons/5-migrate-application-to-the-cloud/README.md @@ -311,7 +311,7 @@ This will create a folder inside the `soil-moisture-trigger` folder called `iot- * `"type": "eventHubTrigger"` - this tells the function it needs to listen to events from an Event Hub * `"name": "events"` - this is the parameter name to use for the Event Hub events. This matches the parameter name in the `main` function in the Python code. - * `"direction": "in",` - this is an input binding, the data from the event hub comes into the function + * `"direction": "in"` - this is an input binding, the data from the event hub comes into the function * `"connection": ""` - this defines the name of the setting to read the connection string from. When running locally, this will read this setting from the `local.settings.json` file. > 💁 The connection string cannot be stored in the `function.json` file, it has to be read from the settings. This is to stop you accidentally exposing your connection string. @@ -326,6 +326,10 @@ This will create a folder inside the `soil-moisture-trigger` folder called `iot- ### Task - run the event trigger +1. Make sure you are not running the IoT Hub event monitor. If this is running at the same time as the functions app, the functions app will not be able to connect and consume events. + + > 💁 Multiple apps can connect to the IoT Hub endpoints using different *consumer groups*. These are covered in a later lesson. + 1. To run the Functions app, run the following command from the VS Code terminal ```sh diff --git a/3-transport/lessons/2-store-location-data/README.md b/3-transport/lessons/2-store-location-data/README.md index f087f430..44f77691 100644 --- a/3-transport/lessons/2-store-location-data/README.md +++ b/3-transport/lessons/2-store-location-data/README.md @@ -341,6 +341,9 @@ The data will be saved as a JSON blob with the following format: [2021-05-21T01:31:14.351Z] Writing blob to gps-sensor/4b6089fe-ba8d-11eb-bc7b-1e00621e3648.json - {'device_id': 'gps-sensor', 'timestamp': '2021-05-21T00:57:53.878Z', 'gps': {'lat': 47.73092, 'lon': -122.26206}} ``` + > 💁 Make sure you are not running the IoT Hub event monitor at the same time. + + > 💁 You can find this code in the [code/functions](code/functions) folder. ### Task - verify the uploaded blobs diff --git a/3-transport/lessons/4-geofences/README.md b/3-transport/lessons/4-geofences/README.md index b0713534..8bc8e886 100644 --- a/3-transport/lessons/4-geofences/README.md +++ b/3-transport/lessons/4-geofences/README.md @@ -324,6 +324,8 @@ When you create an IoT Hub, you get the `$Default` consumer group created by def geofence gps-sensor ``` +> 💁 When you ran the IoT Hub event monitor in an earlier lesson, it connected to the `$Default` consumer group. This was why you can't run the event monitor and an event trigger. If you want to run both, then you can use other consumer groups for all your function apps, and keep `$Default` for the event monitor. + ### Task - create a new IoT Hub trigger 1. Add a new IoT Hub event trigger to your `gps-trigger` function app that you created in an earlier lesson. Call this function `geofence-trigger`.