Skip to content

Commit

Permalink
flow example
Browse files Browse the repository at this point in the history
  • Loading branch information
mrgrain committed Dec 16, 2024
1 parent 4bb183c commit 024499f
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion text/0300-programmatic-toolkit.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,37 @@ const cdk = new Toolkit({
#### Messages and Requests

The toolkit emits *messages* and *requests* to structure interactions.
A *request* is a *message* that requires the receiver to respond, otherwise the toolkit will continue with a default response.
A *request* is a special *message* that allows the receiver to respond, if none is given the toolkit will continue with a default.
*Messages* and *requests* only originate from the toolkit and flow to the integrator.

```mermaid
sequenceDiagram
participant T as Toolkit
participant I as Integrator
T->>I: Starting deployment
T->>I: Found 2 stacks
T->>I: Diff of Stack A
T->>I: Found security relevant changes in Stack A, continue?
create actor U as User
I-->>U: Please confirm these changes (Y/N)
destroy U
U-->>I: Y
I->>T: true
T->>I: Diff of Stack B
T->>I: Deploying Stack A
T->>I: Stack Event 1 for Stack A
T->>I: Stack Event 2 for Stack A
T->>I: Completed deployment of Stack A
T->>I: Deploying Stack B
T->>I: Stack Event 1 for Stack B
T->>I: Stack Event 2 for Stack B
T->>I: Completed deployment of Stack B
```

For every emitted message, the toolkit calls the `notify` or `requestResponse` method of an `IoHost` (more on this below).
Every call is `await`ed for its completion, allowing to receiver to perform asynchronous operations like HTTP calls.
It's okay for the receiver not do anything with the input and return immediately.

The type definition of messages and requests is as follows
(types are illustrative only and implementation might change):

Expand Down

0 comments on commit 024499f

Please sign in to comment.