Skip to content

Commit

Permalink
Add uuid
Browse files Browse the repository at this point in the history
  • Loading branch information
palPalani committed Jan 19, 2021
1 parent 94861f8 commit aedd575
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/Sqs/Queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Illuminate\Queue\SqsQueue;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Str;
use palPalani\SqsQueueReader\Jobs\DispatcherJob;

/**
Expand Down Expand Up @@ -81,11 +82,8 @@ public function pop($queue = null)

$response = $this->modifyPayload($response['Messages'], $class);
Log::debug('New $responseV2==', [$response]);
if (preg_match('/(5\.[4-8]\..*)|(6\.[0-9]*\..*)|(7\.[0-9]*\..*)|(8\.[0-9]*\..*)/', $this->container->version())) {
return new SqsJob($this->container, $this->sqs, $response, $this->connectionName, $queue);
}

return new SqsJob($this->container, $this->sqs, $queue, $response);
return new SqsJob($this->container, $this->sqs, $response, $this->connectionName, $queue);
}
}

Expand Down Expand Up @@ -122,6 +120,7 @@ private function modifyPayload($payload, $class)
}

$body = [
'uuid' => (string) Str::uuid(),
'job' => $class . '@handle',
'data' => $body,
];
Expand Down
2 changes: 2 additions & 0 deletions src/SqsQueueReaderServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace palPalani\SqsQueueReader;

use Illuminate\Queue\Events\JobProcessed;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Queue;
use Illuminate\Support\ServiceProvider;
use palPalani\SqsQueueReader\Sqs\Connector;
Expand All @@ -17,6 +18,7 @@ public function boot(): void
], 'config');

Queue::after(static function (JobProcessed $event) {
Log::debug('Job data==', [$event->job]);
$event->job->delete();
});
}
Expand Down

0 comments on commit aedd575

Please sign in to comment.