mirror of
https://github.com/oarkflow/mq.git
synced 2025-10-05 16:06:55 +08:00
19 lines
399 B
Go
19 lines
399 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"github.com/oarkflow/mq"
|
|
)
|
|
|
|
func main() {
|
|
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())
|
|
}
|