Skip to content

Commit 151d159

Browse files
committed
ignore delete queue if context does not support that
1 parent 3f8d951 commit 151d159

4 files changed

Lines changed: 4 additions & 18 deletions

File tree

‎pkg/enqueue/Client/RpcClient.php‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,7 @@ public function callAsync($topic, $message, $timeout)
116116
};
117117

118118
$finally = function (Promise $promise) use ($replyQueue) {
119-
if ($promise->isDeleteReplyQueue()) {
120-
if (false == method_exists($this->context, 'deleteQueue')) {
121-
throw new \RuntimeException(sprintf('Context does not support delete queues: "%s"', get_class($this->context)));
122-
}
123-
119+
if ($promise->isDeleteReplyQueue() && method_exists($this->context, 'deleteQueue')) {
124120
$this->context->deleteQueue($replyQueue);
125121
}
126122
};

‎pkg/enqueue/Rpc/RpcClient.php‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,7 @@ public function callAsync(PsrDestination $destination, PsrMessage $message, $tim
104104
};
105105

106106
$finally = function (Promise $promise) use ($replyQueue) {
107-
if ($promise->isDeleteReplyQueue()) {
108-
if (false == method_exists($this->context, 'deleteQueue')) {
109-
throw new \RuntimeException(sprintf('Context does not support delete queue: "%s"', get_class($this->context)));
110-
}
111-
107+
if ($promise->isDeleteReplyQueue() && method_exists($this->context, 'deleteQueue')) {
112108
$this->context->deleteQueue($replyQueue);
113109
}
114110
};

‎pkg/enqueue/Tests/Client/RpcClientTest.php‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ public function testShouldDeleteQueueAfterReceiveIfDeleteReplyQueueIsTrue()
297297
$promise->receive();
298298
}
299299

300-
public function testShouldThrowExceptionIfDeleteReplyQueueIsTrueButContextHasNoDeleteQueueMethod()
300+
public function testShouldNotCallDeleteQueueIfDeleteReplyQueueIsTrueButContextHasNoDeleteQueueMethod()
301301
{
302302
$replyQueue = new NullQueue('theReplyTo');
303303
$message = new Message();
@@ -333,9 +333,6 @@ public function testShouldThrowExceptionIfDeleteReplyQueueIsTrueButContextHasNoD
333333
$promise = $rpc->callAsync('topic', $message, 2);
334334
$promise->setDeleteReplyQueue(true);
335335

336-
$this->expectException(\RuntimeException::class);
337-
$this->expectExceptionMessage('Context does not support delete queue');
338-
339336
$promise->receive();
340337
}
341338

‎pkg/enqueue/Tests/Rpc/RpcClientTest.php‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ public function testShouldDeleteQueueAfterReceiveIfDeleteReplyQueueIsTrue()
255255
$promise->receive();
256256
}
257257

258-
public function testShouldThrowExceptionIfDeleteReplyQueueIsTrueButContextHasNoDeleteQueueMethod()
258+
public function testShouldNotCallDeleteQueueIfDeleteReplyQueueIsTrueButContextHasNoDeleteQueueMethod()
259259
{
260260
$queue = new NullQueue('aQueue');
261261
$replyQueue = new NullQueue('theReplyTo');
@@ -297,9 +297,6 @@ public function testShouldThrowExceptionIfDeleteReplyQueueIsTrueButContextHasNoD
297297
$promise = $rpc->callAsync($queue, $message, 2);
298298
$promise->setDeleteReplyQueue(true);
299299

300-
$this->expectException(\RuntimeException::class);
301-
$this->expectExceptionMessage('Context does not support delete queue');
302-
303300
$promise->receive();
304301
}
305302

0 commit comments

Comments
 (0)