Skip to content

Commit

Permalink
Merge pull request #17 from kafkiansky/feature/durable-queue
Browse files Browse the repository at this point in the history
Allow to define durable queue info property
  • Loading branch information
butschster authored May 25, 2022
2 parents cf4f701 + 332a4d1 commit 4008783
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/Queue/AMQPCreateInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ final class AMQPCreateInfo extends CreateInfo
*/
public const REQUEUE_ON_FAIL_DEFAULT_VALUE = false;

/**
* @var bool
*/
public const DURABLE_DEFAULT_VALUE = false;

/**
* @var positive-int
*/
Expand Down Expand Up @@ -103,6 +108,11 @@ final class AMQPCreateInfo extends CreateInfo
*/
public bool $requeueOnFail = self::REQUEUE_ON_FAIL_DEFAULT_VALUE;

/**
* @var bool
*/
public bool $durable = self::DURABLE_DEFAULT_VALUE;

/**
* @param non-empty-string $name
* @param positive-int $priority
Expand All @@ -114,6 +124,7 @@ final class AMQPCreateInfo extends CreateInfo
* @param bool $exclusive
* @param bool $multipleAck
* @param bool $requeueOnFail
* @param bool $durable
*/
public function __construct(
string $name,
Expand All @@ -125,7 +136,8 @@ public function __construct(
string $routingKey = self::ROUTING_KEY_DEFAULT_VALUE,
bool $exclusive = self::EXCLUSIVE_DEFAULT_VALUE,
bool $multipleAck = self::MULTIPLE_ACK_DEFAULT_VALUE,
bool $requeueOnFail = self::REQUEUE_ON_FAIL_DEFAULT_VALUE
bool $requeueOnFail = self::REQUEUE_ON_FAIL_DEFAULT_VALUE,
bool $durable = self::DURABLE_DEFAULT_VALUE
) {
parent::__construct(Driver::AMQP, $name, $priority);

Expand All @@ -142,6 +154,7 @@ public function __construct(
$this->exclusive = $exclusive;
$this->multipleAck = $multipleAck;
$this->requeueOnFail = $requeueOnFail;
$this->durable = $durable;
}

/**
Expand All @@ -158,6 +171,7 @@ public function toArray(): array
'exclusive' => $this->exclusive,
'multiple_ack' => $this->multipleAck,
'requeue_on_fail' => $this->requeueOnFail,
'durable' => $this->durable,
]);
}
}

0 comments on commit 4008783

Please sign in to comment.