mirror of
https://github.com/oarkflow/mq.git
synced 2025-09-30 22:02:15 +08:00
19 lines
391 B
Go
19 lines
391 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"github.com/oarkflow/mq"
|
|
)
|
|
|
|
func main() {
|
|
b := mq.NewBroker(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")
|
|
}
|