Skip to content

Commit

Permalink
Added the reason in the message publish to RabbitMQ
Browse files Browse the repository at this point in the history
  • Loading branch information
sebprt committed Oct 20, 2023
1 parent 3e16e14 commit b74c606
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/Rejection.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
use Bunny\Channel;
use Bunny\Client;
use Kiboko\Contract\Pipeline\RejectionInterface;
use Kiboko\Contract\Pipeline\RejectionWithReasonInterface;

final readonly class Rejection implements RejectionInterface
final readonly class Rejection implements RejectionInterface, RejectionWithReasonInterface

Check failure on line 12 in src/Rejection.php

View workflow job for this annotation

GitHub Actions / phpstan

Class Kiboko\Component\Flow\RabbitMQ\Rejection implements unknown interface Kiboko\Contract\Pipeline\RejectionWithReasonInterface.

Check failure on line 12 in src/Rejection.php

View workflow job for this annotation

GitHub Actions / phpstan

Class Kiboko\Component\Flow\RabbitMQ\Rejection implements unknown interface Kiboko\Contract\Pipeline\RejectionWithReasonInterface.

Check failure on line 12 in src/Rejection.php

View workflow job for this annotation

GitHub Actions / phpstan

Class Kiboko\Component\Flow\RabbitMQ\Rejection implements unknown interface Kiboko\Contract\Pipeline\RejectionWithReasonInterface.
{
private Channel $channel;

Expand Down Expand Up @@ -86,6 +87,23 @@ public function reject(object|array $rejection, ?\Throwable $exception = null):
);
}

public function rejectWithReason(object|array $rejection, string $reason, ?\Throwable $exception = null): void

Check failure on line 90 in src/Rejection.php

View workflow job for this annotation

GitHub Actions / phpstan

Method Kiboko\Component\Flow\RabbitMQ\Rejection::rejectWithReason() has parameter $rejection with no value type specified in iterable type array.
{
$this->channel->publish(
json_encode([
'item' => $rejection,
'reason' => $reason,
'exception' => $exception,
'step' => $this->stepUuid,
], \JSON_THROW_ON_ERROR),
[
'content-type' => 'application/json',
],
$this->exchange,
$this->topic,
);
}

public function initialize(): void
{
$this->channel->queueDeclare(
Expand Down

0 comments on commit b74c606

Please sign in to comment.