@@ -106,6 +106,7 @@ import (
106
106
" time"
107
107
108
108
" github.com/golang-queue/queue"
109
+ " github.com/golang-queue/queue/core"
109
110
)
110
111
111
112
type job struct {
@@ -126,7 +127,7 @@ func main() {
126
127
rets := make (chan string , taskN)
127
128
128
129
// 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 {
130
131
v , ok := m.(*job)
131
132
if !ok {
132
133
if err := json.Unmarshal (m.Bytes (), &v); err != nil {
@@ -177,6 +178,7 @@ import (
177
178
178
179
" github.com/golang-queue/nsq"
179
180
" github.com/golang-queue/queue"
181
+ " github.com/golang-queue/queue/core"
180
182
)
181
183
182
184
type job struct {
@@ -202,7 +204,7 @@ func main() {
202
204
nsq.WithChannel (" foobar" ),
203
205
// concurrent job number
204
206
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 {
206
208
v , ok := m.(*job)
207
209
if !ok {
208
210
if err := json.Unmarshal (m.Bytes (), &v); err != nil {
@@ -257,6 +259,7 @@ import (
257
259
258
260
" github.com/golang-queue/nats"
259
261
" github.com/golang-queue/queue"
262
+ " github.com/golang-queue/queue/core"
260
263
)
261
264
262
265
type job struct {
@@ -280,7 +283,7 @@ func main() {
280
283
nats.WithAddr (" 127.0.0.1:4222" ),
281
284
nats.WithSubj (" example" ),
282
285
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 {
284
287
v , ok := m.(*job)
285
288
if !ok {
286
289
if err := json.Unmarshal (m.Bytes (), &v); err != nil {
@@ -340,6 +343,7 @@ import (
340
343
" time"
341
344
342
345
" github.com/golang-queue/queue"
346
+ " github.com/golang-queue/queue/core"
343
347
" github.com/golang-queue/redisdb"
344
348
)
345
349
@@ -363,7 +367,7 @@ func main() {
363
367
w := redisdb.NewWorker (
364
368
redisdb.WithAddr (" 127.0.0.1:6379" ),
365
369
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 {
367
371
v , ok := m.(*job)
368
372
if !ok {
369
373
if err := json.Unmarshal (m.Bytes (), &v); err != nil {
0 commit comments