@@ -133,8 +133,8 @@ func TestCustomFuncAndWait(t *testing.T) {
133133 WithAddr (endpoint ),
134134 WithSubj ("test" ),
135135 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 ()))
138138 time .Sleep (500 * time .Millisecond )
139139 return nil
140140 }),
@@ -192,11 +192,11 @@ func TestJobReachTimeout(t *testing.T) {
192192 WithAddr (endpoint ),
193193 WithSubj ("JobReachTimeout" ),
194194 WithQueue ("test" ),
195- WithRunFunc (func (ctx context.Context , m core.QueuedMessage ) error {
195+ WithRunFunc (func (ctx context.Context , m core.TaskMessage ) error {
196196 for {
197197 select {
198198 case <- ctx .Done ():
199- log .Println ("get data:" , string (m .Bytes ()))
199+ log .Println ("get data:" , string (m .Payload ()))
200200 if errors .Is (ctx .Err (), context .Canceled ) {
201201 log .Println ("queue has been shutdown and cancel the job" )
202202 } else if errors .Is (ctx .Err (), context .DeadlineExceeded ) {
@@ -236,11 +236,11 @@ func TestCancelJobAfterShutdown(t *testing.T) {
236236 WithSubj ("CancelJob" ),
237237 WithQueue ("test" ),
238238 WithLogger (queue .NewLogger ()),
239- WithRunFunc (func (ctx context.Context , m core.QueuedMessage ) error {
239+ WithRunFunc (func (ctx context.Context , m core.TaskMessage ) error {
240240 for {
241241 select {
242242 case <- ctx .Done ():
243- log .Println ("get data:" , string (m .Bytes ()))
243+ log .Println ("get data:" , string (m .Payload ()))
244244 if errors .Is (ctx .Err (), context .Canceled ) {
245245 log .Println ("queue has been shutdown and cancel the job" )
246246 } else if errors .Is (ctx .Err (), context .DeadlineExceeded ) {
@@ -280,19 +280,19 @@ func TestGoroutineLeak(t *testing.T) {
280280 WithSubj ("GoroutineLeak" ),
281281 WithQueue ("test" ),
282282 WithLogger (queue .NewEmptyLogger ()),
283- WithRunFunc (func (ctx context.Context , m core.QueuedMessage ) error {
283+ WithRunFunc (func (ctx context.Context , m core.TaskMessage ) error {
284284 for {
285285 select {
286286 case <- ctx .Done ():
287- log .Println ("get data:" , string (m .Bytes ()))
287+ log .Println ("get data:" , string (m .Payload ()))
288288 if errors .Is (ctx .Err (), context .Canceled ) {
289289 log .Println ("queue has been shutdown and cancel the job" )
290290 } else if errors .Is (ctx .Err (), context .DeadlineExceeded ) {
291291 log .Println ("job deadline exceeded" )
292292 }
293293 return nil
294294 default :
295- log .Println ("get data:" , string (m .Bytes ()))
295+ log .Println ("get data:" , string (m .Payload ()))
296296 time .Sleep (50 * time .Millisecond )
297297 return nil
298298 }
@@ -327,7 +327,7 @@ func TestGoroutinePanic(t *testing.T) {
327327 w := NewWorker (
328328 WithAddr (endpoint ),
329329 WithSubj ("GoroutinePanic" ),
330- WithRunFunc (func (ctx context.Context , m core.QueuedMessage ) error {
330+ WithRunFunc (func (ctx context.Context , m core.TaskMessage ) error {
331331 panic ("missing something" )
332332 }),
333333 )
@@ -351,7 +351,7 @@ func TestReQueueTaskInWorkerBeforeShutdown(t *testing.T) {
351351 natsC , endpoint := setupNatsContainer (ctx , t )
352352 defer testcontainers .CleanupContainer (t , natsC )
353353 job := & job.Message {
354- Payload : []byte ("foo" ),
354+ Body : []byte ("foo" ),
355355 }
356356 w := NewWorker (
357357 WithAddr (endpoint ),
0 commit comments