You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This project template illustrates the design pattern for subscription style business logic.
Setup
Run the Temporal Server:
git clone https://github.com/temporalio/docker-compose.git
cd docker-compose
docker-compose up
Start
Start the Worker:
go run worker/main.go
Start the Workflow Executions:
go run starter/main.go
This will start the Workflow Executions for 5 customers with the following Ids:
Id-0
Id-1
Id-2
Id-3
Id-4
Get billing info
You can Query the Workflow Executions and get the billing information for each customer.
go run querybillinginfo/main.go
Run this multiple times to see the billing period number increase during the executions or see the billing cycle cost.
Update billing
You can send a Signal a Workflow Execution to update the billing cycle cost to 300 for all customers.
go run updatechargeamount/main.go
Cancel subscription
You can send a Signal to all Workflow Executions to cancel the subscription for all customers.
Workflow Executions will complete after the currently executing billing period.
go run cancelsubscription/main.go
After running this, check out the Temporal Web UI and see that all subscription Workflow Executions have a "Completed" status.