Documentation
¶
Overview ¶
Package main demonstrates a comprehensive Dispatch setup with jobs, workflows, cron scheduling, saga compensations, child workflows, and a DWP WebSocket server. Run it and connect via WebSocket, HTTP RPC, or the Go/TS/Python client.
Usage:
go run .
Then in another terminal:
# Enqueue a job via HTTP RPC
curl -X POST http://localhost:8080/dwp/rpc \
-H "Content-Type: application/json" \
-d '{
"id": "req-1",
"type": "request",
"method": "job.enqueue",
"token": "demo-token",
"data": {"name":"send-email","payload":{"to":"user@example.com","subject":"Hello"}}
}'
# Start a workflow via HTTP RPC
curl -X POST http://localhost:8080/dwp/rpc \
-H "Content-Type: application/json" \
-d '{
"id": "req-2",
"type": "request",
"method": "workflow.start",
"token": "demo-token",
"data": {"name":"order-pipeline","input":{"order_id":"ORD-001","items":["widget","gadget"]}}
}'
# Get stats
curl -X POST http://localhost:8080/dwp/rpc \
-H "Content-Type: application/json" \
-d '{"id":"req-3","type":"request","method":"stats","token":"demo-token"}'
Click to show internal directories.
Click to hide internal directories.