mirror of
https://github.com/oarkflow/mq.git
synced 2025-10-04 07:37:05 +08:00
feat: Add README.md
This commit is contained in:
@@ -2,16 +2,13 @@ package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/oarkflow/mq"
|
||||
"github.com/oarkflow/mq/examples/tasks"
|
||||
)
|
||||
|
||||
func main() {
|
||||
b := mq.NewBroker(mq.WithCallback(func(ctx context.Context, task mq.Result) mq.Result {
|
||||
fmt.Println("Received task", task.MessageID, "Payload", string(task.Payload), task.Error, task.Queue)
|
||||
return mq.Result{}
|
||||
}))
|
||||
b := mq.NewBroker(mq.WithCallback(tasks.Callback))
|
||||
b.NewQueue("queue1")
|
||||
b.NewQueue("queue2")
|
||||
b.Start(context.Background())
|
||||
|
Reference in New Issue
Block a user