@@ -133,8 +133,8 @@ func TestCustomFuncAndWait(t *testing.T) {
133
133
WithAddr (endpoint ),
134
134
WithSubj ("test" ),
135
135
WithQueue ("test" ),
136
- WithRunFunc (func (ctx context.Context , m core.QueuedMessage ) error {
137
- log .Println ("show message: " + string (m .Bytes ()))
136
+ WithRunFunc (func (ctx context.Context , m core.TaskMessage ) error {
137
+ log .Println ("show message: " + string (m .Payload ()))
138
138
time .Sleep (500 * time .Millisecond )
139
139
return nil
140
140
}),
@@ -192,11 +192,11 @@ func TestJobReachTimeout(t *testing.T) {
192
192
WithAddr (endpoint ),
193
193
WithSubj ("JobReachTimeout" ),
194
194
WithQueue ("test" ),
195
- WithRunFunc (func (ctx context.Context , m core.QueuedMessage ) error {
195
+ WithRunFunc (func (ctx context.Context , m core.TaskMessage ) error {
196
196
for {
197
197
select {
198
198
case <- ctx .Done ():
199
- log .Println ("get data:" , string (m .Bytes ()))
199
+ log .Println ("get data:" , string (m .Payload ()))
200
200
if errors .Is (ctx .Err (), context .Canceled ) {
201
201
log .Println ("queue has been shutdown and cancel the job" )
202
202
} else if errors .Is (ctx .Err (), context .DeadlineExceeded ) {
@@ -236,11 +236,11 @@ func TestCancelJobAfterShutdown(t *testing.T) {
236
236
WithSubj ("CancelJob" ),
237
237
WithQueue ("test" ),
238
238
WithLogger (queue .NewLogger ()),
239
- WithRunFunc (func (ctx context.Context , m core.QueuedMessage ) error {
239
+ WithRunFunc (func (ctx context.Context , m core.TaskMessage ) error {
240
240
for {
241
241
select {
242
242
case <- ctx .Done ():
243
- log .Println ("get data:" , string (m .Bytes ()))
243
+ log .Println ("get data:" , string (m .Payload ()))
244
244
if errors .Is (ctx .Err (), context .Canceled ) {
245
245
log .Println ("queue has been shutdown and cancel the job" )
246
246
} else if errors .Is (ctx .Err (), context .DeadlineExceeded ) {
@@ -280,19 +280,19 @@ func TestGoroutineLeak(t *testing.T) {
280
280
WithSubj ("GoroutineLeak" ),
281
281
WithQueue ("test" ),
282
282
WithLogger (queue .NewEmptyLogger ()),
283
- WithRunFunc (func (ctx context.Context , m core.QueuedMessage ) error {
283
+ WithRunFunc (func (ctx context.Context , m core.TaskMessage ) error {
284
284
for {
285
285
select {
286
286
case <- ctx .Done ():
287
- log .Println ("get data:" , string (m .Bytes ()))
287
+ log .Println ("get data:" , string (m .Payload ()))
288
288
if errors .Is (ctx .Err (), context .Canceled ) {
289
289
log .Println ("queue has been shutdown and cancel the job" )
290
290
} else if errors .Is (ctx .Err (), context .DeadlineExceeded ) {
291
291
log .Println ("job deadline exceeded" )
292
292
}
293
293
return nil
294
294
default :
295
- log .Println ("get data:" , string (m .Bytes ()))
295
+ log .Println ("get data:" , string (m .Payload ()))
296
296
time .Sleep (50 * time .Millisecond )
297
297
return nil
298
298
}
@@ -327,7 +327,7 @@ func TestGoroutinePanic(t *testing.T) {
327
327
w := NewWorker (
328
328
WithAddr (endpoint ),
329
329
WithSubj ("GoroutinePanic" ),
330
- WithRunFunc (func (ctx context.Context , m core.QueuedMessage ) error {
330
+ WithRunFunc (func (ctx context.Context , m core.TaskMessage ) error {
331
331
panic ("missing something" )
332
332
}),
333
333
)
@@ -351,7 +351,7 @@ func TestReQueueTaskInWorkerBeforeShutdown(t *testing.T) {
351
351
natsC , endpoint := setupNatsContainer (ctx , t )
352
352
defer testcontainers .CleanupContainer (t , natsC )
353
353
job := & job.Message {
354
- Payload : []byte ("foo" ),
354
+ Body : []byte ("foo" ),
355
355
}
356
356
w := NewWorker (
357
357
WithAddr (endpoint ),
0 commit comments