feat: Add README.md

This commit is contained in:
sujit
2024-10-01 10:36:24 +05:45
parent 96e5f98bae
commit cb1dc46436
5 changed files with 236 additions and 33 deletions

View File

@@ -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())