Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/liammartens/asynqchainmiddleware
https://github.com/liammartens/asynqchainmiddleware
Last synced: 11 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/liammartens/asynqchainmiddleware
- Owner: LiamMartens
- License: mit
- Created: 2024-05-16T00:30:30.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-05-16T00:35:28.000Z (8 months ago)
- Last Synced: 2024-10-18T16:13:27.897Z (2 months ago)
- Language: Go
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# asynqchainmiddleware
This middleware can be used to create a task chain workflow in with [asynq](github.com/hibiken/asynq)## Usage
```go
import (
"github.com/hibiken/asynq"
"asynqchainmiddleware"
)redis_config := asynq.RedisClientOpt{
Addr: "127.0.0.1:6379",
}
client := asynq.NewClient(redis_config)
server := asynq.NewServer(redis_config, asynq.Config{})mux := asynq.NewServeMux()
mux.Use(ChainTasksMiddlewareFactory(client))
mux.HandleFunc("task1", func(ctx context.Context, t *asynq.Task) error {
task := asynq.NewTask("task2", nil)
return &ErrChainTask{
Task: task,
}
})
```