Deprecate option prefetch_count
This commit is contained in:
parent
b34890a41c
commit
5b55097500
@ -23,6 +23,11 @@ HttpKernel
|
||||
|
||||
* Marked the class `Symfony\Component\HttpKernel\EventListener\DebugHandlersListener` as internal
|
||||
|
||||
Messenger
|
||||
---------
|
||||
|
||||
* Deprecated the `prefetch_count` parameter in the AMQP bridge, it has no effect and will be removed in Symfony 6.0.
|
||||
|
||||
Notifier
|
||||
-------
|
||||
|
||||
|
@ -112,6 +112,7 @@ Messenger
|
||||
* Use of invalid options in Redis and AMQP connections now throws an error.
|
||||
* The signature of method `RetryStrategyInterface::isRetryable()` has been updated to `RetryStrategyInterface::isRetryable(Envelope $message, \Throwable $throwable = null)`.
|
||||
* The signature of method `RetryStrategyInterface::getWaitingTime()` has been updated to `RetryStrategyInterface::getWaitingTime(Envelope $message, \Throwable $throwable = null)`.
|
||||
* Removed the `prefetch_count` parameter in the AMQP bridge.
|
||||
|
||||
Mime
|
||||
----
|
||||
|
@ -1,6 +1,11 @@
|
||||
CHANGELOG
|
||||
=========
|
||||
|
||||
5.3.0
|
||||
-----
|
||||
|
||||
* Deprecated the `prefetch_count` parameter, it has no effect and will be removed in Symfony 6.0.
|
||||
|
||||
5.2.0
|
||||
-----
|
||||
|
||||
|
@ -439,6 +439,9 @@ class ConnectionTest extends TestCase
|
||||
$connection->publish('body');
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
public function testSetChannelPrefetchWhenSetup()
|
||||
{
|
||||
$factory = new TestAmqpFactory(
|
||||
@ -451,11 +454,11 @@ class ConnectionTest extends TestCase
|
||||
// makes sure the channel looks connected, so it's not re-created
|
||||
$amqpChannel->expects($this->any())->method('isConnected')->willReturn(true);
|
||||
|
||||
$amqpChannel->expects($this->exactly(2))->method('setPrefetchCount')->with(2);
|
||||
$amqpChannel->expects($this->never())->method('setPrefetchCount');
|
||||
|
||||
$this->expectDeprecation('Since symfony/messenger 5.3: The "prefetch_count" option passed to the AMQP Messenger transport has no effect and should not be used.');
|
||||
$connection = Connection::fromDsn('amqp://localhost?prefetch_count=2', [], $factory);
|
||||
$connection->setup();
|
||||
$connection = Connection::fromDsn('amqp://localhost', ['prefetch_count' => 2], $factory);
|
||||
$connection->setup();
|
||||
}
|
||||
|
||||
public function testAutoSetupWithDelayDeclaresExchangeQueuesAndDelay()
|
||||
|
@ -149,7 +149,6 @@ class Connection
|
||||
* * queue_name_pattern: Pattern to use to create the queues (Default: "delay_%exchange_name%_%routing_key%_%delay%")
|
||||
* * exchange_name: Name of the exchange to be used for the delayed/retried messages (Default: "delays")
|
||||
* * auto_setup: Enable or not the auto-setup of queues and exchanges (Default: true)
|
||||
* * prefetch_count: set channel prefetch count
|
||||
*
|
||||
* * Connection tuning options (see http://www.rabbitmq.com/amqp-0-9-1-reference.html#connection.tune for details):
|
||||
* * channel_max: Specifies highest channel number that the server permits. 0 means standard extension limit
|
||||
@ -238,6 +237,10 @@ class Connection
|
||||
trigger_deprecation('symfony/messenger', '5.1', 'Invalid option(s) "%s" passed to the AMQP Messenger transport. Passing invalid options is deprecated.', implode('", "', $invalidOptions));
|
||||
}
|
||||
|
||||
if (isset($options['prefetch_count'])) {
|
||||
trigger_deprecation('symfony/messenger', '5.3', 'The "prefetch_count" option passed to the AMQP Messenger transport has no effect and should not be used.');
|
||||
}
|
||||
|
||||
if (\is_array($options['queues'] ?? false)) {
|
||||
foreach ($options['queues'] as $queue) {
|
||||
if (!\is_array($queue)) {
|
||||
@ -492,10 +495,6 @@ class Connection
|
||||
}
|
||||
$this->amqpChannel = $this->amqpFactory->createChannel($connection);
|
||||
|
||||
if (isset($this->connectionOptions['prefetch_count'])) {
|
||||
$this->amqpChannel->setPrefetchCount($this->connectionOptions['prefetch_count']);
|
||||
}
|
||||
|
||||
if ('' !== ($this->connectionOptions['confirm_timeout'] ?? '')) {
|
||||
$this->amqpChannel->confirmSelect();
|
||||
$this->amqpChannel->setConfirmCallback(
|
||||
|
Reference in New Issue
Block a user