Skip to content

Commit fc69cf2

Browse files
committed
feat: kq support trace
1 parent b3263d4 commit fc69cf2

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

example/kq/consumer/queue.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package main
22

33
import (
4+
"context"
45
"fmt"
56

67
"github.com/zeromicro/go-queue/kq"
@@ -11,7 +12,7 @@ func main() {
1112
var c kq.KqConf
1213
conf.MustLoad("config.yaml", &c)
1314

14-
q := kq.MustNewQueue(c, kq.WithHandle(func(k, v string) error {
15+
q := kq.MustNewQueue(c, kq.WithHandle(func(ctx context.Context, k, v string) error {
1516
fmt.Printf("=> %s\n", v)
1617
return nil
1718
}))

example/kq/producer/produce.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package main
22

33
import (
4+
"context"
45
"encoding/json"
56
"fmt"
67
"log"
@@ -41,7 +42,7 @@ func main() {
4142
}
4243

4344
fmt.Println(string(body))
44-
if err := pusher.Push(string(body)); err != nil {
45+
if err := pusher.Push(context.Background(), string(body)); err != nil {
4546
log.Fatal(err)
4647
}
4748
}

0 commit comments

Comments
 (0)