This project demonstrates how Benthos can be used to drive Temporal workflow execution.
Make sure Temporal Server is running first:
git clone https://github.com/temporalio/docker-compose.git
cd docker-compose
docker-compose up
Leave it running. You can use the Temporal Web UI at localhost:8080 which is currently in Beta. To use the legacy Temporal Web UI, use the localhost:8088 URL instead. There should be no workflows visible in the dashboard right now.
In another terminal instance, clone this repo and run this application.
git clone https://github.com/disintegrator/benthos-temporal-poc.git
cd benthos-temporal-poc
go run benthos/main.go --log.level debug -c config.generate.yml
Observe that Temporal Web reflects the workflow, but it is still in "Running" status. This is because there is no Workflow or Activity Worker yet listening to the TRANSFER_MONEY_TASK_QUEUE
task queue to process this work.
There is also an alternate pipeline configuration which reads data from a file and uses lines within it to trigger executions. You can run it like so:
go run benthos/main.go --log.level debug -c config.file.yml
In YET ANOTHER terminal instance, run the worker. Notice that this worker hosts both Workflow and Activity functions.
go run worker/main.go
Now you can see the workflow run to completion. You can also see the worker polling for workflows and activities in the task queue at http://localhost:8080/namespaces/default/task-queues/TRANSFER_MONEY_TASK_QUEUE.
You can run the Workflow code a few more times with go run benthos/main.go --log.level debug -c config.yml
to understand how it interacts with the Worker and Temporal Server.