init: publisher

This commit is contained in:
sujit
2024-09-27 17:44:27 +05:45
parent 3b80ab6ba6
commit 6657728f6c
8 changed files with 189 additions and 49 deletions

View File

@@ -8,10 +8,10 @@ import (
)
func main() {
b := mq.NewBroker(func(ctx context.Context, task *mq.Task) error {
b := mq.NewBroker(mq.WithCallback(func(ctx context.Context, task *mq.Task) error {
fmt.Println("Received task", task.ID, "Payload", string(task.Payload), "Result", string(task.Result), task.Error, task.CurrentQueue)
return nil
})
}))
b.NewQueue("queue1")
b.NewQueue("queue2")
b.Start(context.Background(), ":8080")