Small POC project to try out the Temporal workflow engine together with Netflix's Dispatch Incident Management System.
Pure for fun there are two workflows implemented:
- Showing a random dog picture from dog.ceo
- A similar workflow to get a random photo from Unsplash.
Both workflows have a bit of delay in them to suggest hard work and state changes.
For this project I had two goals:
- Get experience with the Temporal Workflow engine.
- Adding a workflow system to Dispatch through a generic workflow plugin that I contributed to Dispatch.
- Providing an example to others that want to start using Dispatch and that need an easy way to start with workflows.
You can either download this project and build it from source or you could download the binaries.
./td -api=:8888 -temporal=localhost:7233 -queue=dispatch
Assuming you already have Dispatch and Temporal running. The quickest way to test this is to run both from Docker compose.
To enable the Generic Workflow Plugin in Dispatch:
- Login to Dispatch
- Navigate to: Settings > Projects > default.
- Click Plugins
- Click NEW
- Select Generic Workflow Plugin
- Save
Now you need to configure the plugin to point to the API from this project. If you run Dispatch in Docker and run this API on the Docker host, you can use the Docker gateway IP to connect. In that case the URL would be something like: http://172.17.0.1:8888/workflow/
Currently, there is no authentication on the API.
Enable the plugin and save.
- Under Settings go to Workflows
- Add new workflow:
- Name: Random dog
- Resource ID: random_dog
- Description: Gets a random dog picture
- Plugin: Generic Workflow Plugin
- Enabled: true
- SAVE
- Add new workflow:
- Name: Random Unsplash
- Resource ID: random_unsplash
- Description: Gets a random photo from Unsplash
- Plugin: Generic Workflow Plugin
- Enabled: true
- Workflow Configuration: + add key: term
- SAVE
Now run one of the workflows.
- Add authentication on the API
- Maybe break apart Dispatch structs and helper functions so that they are useful for other API's that don't use Temporal
- Support TLS
- Docker image
This project uses schema-generate to generate the go structs from the Dispatch JSON schema. This is already done and the structs are in the project so there is no use to generate it again unless it changes.