From c0bf0f19b6d136b2b29cf44374040af9adf547b6 Mon Sep 17 00:00:00 2001 From: Kane Menicou Date: Thu, 29 Jun 2023 14:50:56 +0100 Subject: [PATCH] [ADHOC-2812] Store Job ID when job performed --- .../Command/ProcessJobCommand.php | 3 +++ src/Vivait/DelayedEventBundle/Job.php | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 src/Vivait/DelayedEventBundle/Job.php diff --git a/src/Vivait/DelayedEventBundle/Command/ProcessJobCommand.php b/src/Vivait/DelayedEventBundle/Command/ProcessJobCommand.php index a803550..0dbd0ce 100644 --- a/src/Vivait/DelayedEventBundle/Command/ProcessJobCommand.php +++ b/src/Vivait/DelayedEventBundle/Command/ProcessJobCommand.php @@ -12,6 +12,7 @@ use Throwable; use Vivait\DelayedEventBundle\Exception\TerminalEventException; use Vivait\DelayedEventBundle\Exception\TransientEventException; +use Vivait\DelayedEventBundle\Job; use Vivait\DelayedEventBundle\Serializer\SerializerInterface; class ProcessJobCommand extends Command @@ -106,6 +107,8 @@ protected function execute(InputInterface $input, OutputInterface $output) */ private function performJob($jobId, $eventName, $event) { + Job::$id = $jobId; + try { $this->eventDispatcher->dispatch($event, $eventName); } catch (TerminalEventException $exception) { diff --git a/src/Vivait/DelayedEventBundle/Job.php b/src/Vivait/DelayedEventBundle/Job.php new file mode 100644 index 0000000..2afbb47 --- /dev/null +++ b/src/Vivait/DelayedEventBundle/Job.php @@ -0,0 +1,16 @@ +