@@ -5,94 +5,56 @@ Greengrass component.
55
66## Overview
77
8- The sample subscribes to it's own configuration updates and prints notifications
8+ The sample subscribes to its own configuration updates and prints notifications
99whenever the configuration changes. This is useful for components that need to
1010react to configuration changes in real-time.
1111
12- ## Building
13-
14- Build the sample from the project root:
15-
16- ``` sh
17- cmake -B build -D CMAKE_BUILD_TYPE=MinSizeRel -D BUILD_SAMPLES=ON
18- make -C build -j$( nproc)
19- ```
20-
21- The binary will be available at
22- ` ./build/bin/sample_subscribe_to_configuration_update ` .
23-
2412## Usage
2513
2614### ⚠️ Important Notice ⚠️
2715
2816Always subscribe to configuration updates before calling GetConfiguration to
2917ensure you don't miss any updates.
3018
31- ### Deployment
19+ ### Testing Configuration Updates
3220
33- Deploy this component using the provided ` recipe.yml ` . Update the S3 bucket
34- location in the recipe before deployment .
21+ After deploying the component, update its configuration to trigger the
22+ subscription callback .
3523
36- ### Step by Step guide
24+ ** Using AWS Console: **
3725
38- 1 . Deploy the Component to your Greengrass device. A detailed guid can be found
39- [ here] ( https://docs.aws.amazon.com/greengrass/v2/developerguide/create-deployments.html ) .
40-
41- 2 . Check the initial logs:
42-
43- ``` sh
44- journalctl -fau ggl.aws-greengrass-sdk-lite.samples.subscribe_to_configuration_update.service
26+ 1 . Navigate to AWS IoT Greengrass console
27+ 2 . Select ` Deployments ` and find the deployment targeting your thing group
28+ 3 . Click ` Actions ` > ` Revise ` > ` Next ` > ` Next `
29+ 4 . Find ` aws-greengrass-sdk-lite.samples.SubscribeToConfigurationUpdate ` in the
30+ component list
31+ 5 . Click ` Configure component `
32+ 6 . Under ` Configuration to merge ` , add:
33+ ``` json
34+ {
35+ "test_str" : " updated_value"
36+ }
4537 ```
38+ 7 . Click ` Confirm ` > ` Next ` > ` Deploy `
4639
47- 3 . Revise the deployment to update the ` test_str ` configuration value in the
48- ` aws-greengrass-sdk-lite.samples.SubscribeToConfigurationUpdate ` component
49- using the AWS Console:
50- - Navigate to AWS IoT Greengrass console
51- - Select ` Deployments ` and find the deployment targeting your device/group.
52- - Click ` Actions ` > ` Revise ` > ` Revise Deployments ` > ` Next ` > ` Next ` .
53- - Find ` aws-greengrass-sdk-lite.samples.SubscribeToConfigurationUpdate ` in
54- the component list
55- - Click ` Configure component `
56- - Under ` Configuration to merge ` , add:
57-
58- ``` json
59- {
60- "test_str" : " updated_value"
61- }
62- ```
63-
64- - Click `Confirm` and then `Next` through the remaining steps
65- - Click `Deploy` to apply the changes
40+ ** Using AWS CLI:**
6641
67- 4 . After the deployment completes, check the logs again. You should see the
68- callback triggered with a message indicating the configuration update was
69- received
70-
71- 5 . The callback handler will print the component name and key paths that were
72- updated
73-
74- The sample subscribes to the `test_str` key path. To subscribe to all
75- configuration updates, use an empty key path list.
76-
77- #### Alternative: Using AWS CLI
78-
79- To update configuration using AWS CLI:
80-
81- ```sh
42+ ``` bash
8243aws greengrassv2 create-deployment \
83- --target-arn "arn:aws:iot:REGION:ACCOUNT_ID:thinggroup/THING_GROUP_NAME " \
44+ --target-arn " arn:aws:iot:REGION:ACCOUNT_ID:thinggroup/YOUR_THING_GROUP " \
8445 --components ' {
8546 "aws-greengrass-sdk-lite.samples.SubscribeToConfigurationUpdate": {
8647 "componentVersion": "VERSION",
8748 "configurationUpdate": {
8849 "merge": "{\"test_str\":\"updated_value\"}"
8950 }
9051 }
91- }'
52+ }' \
53+ --region YOUR_REGION
9254```
9355
94- Replace ` REGION ` , ` ACCOUNT_ID ` , ` THING_GROUP_NAME ` , and ` VERSION ` with your
95- values .
56+ The sample subscribes to the ` test_str ` key path. To subscribe to all
57+ configuration updates, use an empty key path list .
9658
9759## Known Issues
9860
0 commit comments