Skip to content

Commit a819ea1

Browse files
committed
docs(readme): update example
Signed-off-by: Bo-Yi.Wu <appleboy.tw@gmail.com>
1 parent 698e391 commit a819ea1

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

README.md

+8-4
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ import (
106106
"time"
107107

108108
"github.com/golang-queue/queue"
109+
"github.com/golang-queue/queue/core"
109110
)
110111

111112
type job struct {
@@ -126,7 +127,7 @@ func main() {
126127
rets := make(chan string, taskN)
127128

128129
// initial queue pool
129-
q := queue.NewPool(5, queue.WithFn(func(ctx context.Context, m queue.QueuedMessage) error {
130+
q := queue.NewPool(5, queue.WithFn(func(ctx context.Context, m core.QueuedMessage) error {
130131
v, ok := m.(*job)
131132
if !ok {
132133
if err := json.Unmarshal(m.Bytes(), &v); err != nil {
@@ -177,6 +178,7 @@ import (
177178

178179
"github.com/golang-queue/nsq"
179180
"github.com/golang-queue/queue"
181+
"github.com/golang-queue/queue/core"
180182
)
181183

182184
type job struct {
@@ -202,7 +204,7 @@ func main() {
202204
nsq.WithChannel("foobar"),
203205
// concurrent job number
204206
nsq.WithMaxInFlight(10),
205-
nsq.WithRunFunc(func(ctx context.Context, m queue.QueuedMessage) error {
207+
nsq.WithRunFunc(func(ctx context.Context, m core.QueuedMessage) error {
206208
v, ok := m.(*job)
207209
if !ok {
208210
if err := json.Unmarshal(m.Bytes(), &v); err != nil {
@@ -257,6 +259,7 @@ import (
257259

258260
"github.com/golang-queue/nats"
259261
"github.com/golang-queue/queue"
262+
"github.com/golang-queue/queue/core"
260263
)
261264

262265
type job struct {
@@ -280,7 +283,7 @@ func main() {
280283
nats.WithAddr("127.0.0.1:4222"),
281284
nats.WithSubj("example"),
282285
nats.WithQueue("foobar"),
283-
nats.WithRunFunc(func(ctx context.Context, m queue.QueuedMessage) error {
286+
nats.WithRunFunc(func(ctx context.Context, m core.QueuedMessage) error {
284287
v, ok := m.(*job)
285288
if !ok {
286289
if err := json.Unmarshal(m.Bytes(), &v); err != nil {
@@ -340,6 +343,7 @@ import (
340343
"time"
341344

342345
"github.com/golang-queue/queue"
346+
"github.com/golang-queue/queue/core"
343347
"github.com/golang-queue/redisdb"
344348
)
345349

@@ -363,7 +367,7 @@ func main() {
363367
w := redisdb.NewWorker(
364368
redisdb.WithAddr("127.0.0.1:6379"),
365369
redisdb.WithChannel("foobar"),
366-
redisdb.WithRunFunc(func(ctx context.Context, m queue.QueuedMessage) error {
370+
redisdb.WithRunFunc(func(ctx context.Context, m core.QueuedMessage) error {
367371
v, ok := m.(*job)
368372
if !ok {
369373
if err := json.Unmarshal(m.Bytes(), &v); err != nil {

0 commit comments

Comments
 (0)