Skip to content

Commit b001efa

Browse files
authored
Update RabbitMQQueue.php
1 parent 90be22c commit b001efa

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

src/Queue/RabbitMQQueue.php

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,7 @@ protected function createObjectPayload($job, $queue)
440440
'job' => 'Illuminate\Queue\CallQueuedHandler@call',
441441
'schema' => $this->getSchema($job) ?? null,
442442
'busEvent' => $this->getBusEvent($job) ?? null,
443+
'payload' => $this->getJobPayload($job) ?? null,
443444
'maxTries' => $job->tries ?? null,
444445
'maxExceptions' => $job->maxExceptions ?? null,
445446
'failOnTimeout' => $job->failOnTimeout ?? false,
@@ -465,7 +466,7 @@ protected function createObjectPayload($job, $queue)
465466
}
466467

467468
/**
468-
* Get the schema for the given job.
469+
* Get the display name for the given job.
469470
*
470471
* @param object $job
471472
*/
@@ -479,7 +480,7 @@ protected function getSchema($job): ?string
479480
}
480481

481482
/**
482-
* Get the bus event for the given job.
483+
* Get the display name for the given job.
483484
*
484485
* @param object $job
485486
*/
@@ -492,6 +493,20 @@ protected function getBusEvent($job): ?string
492493
return $job->busEvent ?? null;
493494
}
494495

496+
/**
497+
* Get the display name for the given job.
498+
*
499+
* @param object $job
500+
*/
501+
protected function getJobPayload($job): ?string
502+
{
503+
if (method_exists($job, 'displayName') && isset($job->event) && isset($job->event->payload)) {
504+
return serialize($job->event->payload) ?? null;
505+
}
506+
507+
return isset($job->payload) ? serialize($job->payload) : null;
508+
}
509+
495510
/**
496511
* Declare a queue in rabbitMQ, when not already declared.
497512
*

0 commit comments

Comments
 (0)