Skip to content

Instantly share code, notes, and snippets.

@patrickwerz
Created April 14, 2020 10:47
Show Gist options
  • Save patrickwerz/2964ebf330b9bba23570c74cdf7e4530 to your computer and use it in GitHub Desktop.
Save patrickwerz/2964ebf330b9bba23570c74cdf7e4530 to your computer and use it in GitHub Desktop.
Sequence Diagram: Internal state handling
@startuml
skinparam ParticipantPadding 30
skinparam BoxPadding 25
header
Authors: [email protected]
Version: 0.1
endheader
title Sequence Diagram: Internal state synchronization
== client connection ==
box "Internal Service" #LightGrey
Sender->IoTClient:connect()
IoTClient->ShadowCallback:on_conncet_wrapper()
ShadowCallback->IoTClient:subscribe("AWS Shadow Topics")
end box
box "AWS Cloud" #LightGreen
IoTClient->ShadowService:subscribe()
IoTClient->ShadowCallback:on_subscribe_wrapper()
activate ShadowCallback #FFBBBB
ShadowCallback->ShadowCallback:request_desired_state()
== state retrival ==
IoTClient->ShadowService:publish("myClient/shadow/get")
activate IoTClient #DarkSalmon
deactivate IoTClient
deactivate ShadowCallback
ShadowService->IoTClient:on_message("myClient/shadow/get/accepted", state)
IoTClient->ShadowCallback:on_message_wrapper(rawState)
ShadowCallback->ShadowCallback:on_desired_state_change(rawState)
== state synchronization ==
ShadowCallback->Sender:set_state(desiredState)
Sender->ShadowCallback:on_set_state_wrapper()
activate ShadowCallback #FFBBBB
ShadowCallback->ShadowCallback:publish_new_state()
ShadowCallback->IoTClient:publish("myClient/shadow/update", reportedState)
activate IoTClient #DarkSalmon
IoTClient->ShadowService:publish("myClient/shadow/update", state)
deactivate IoTClient
deactivate ShadowCallback
@enduml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment