From e5221fa13bbef61e2b15f845777e819448cbfa29 Mon Sep 17 00:00:00 2001 From: Josias Montag Date: Fri, 27 May 2022 11:14:06 +0200 Subject: [PATCH] Allow PubSub / MultiExec with Replication --- src/Monitor/Consumer.php | 6 +++--- src/PubSub/Consumer.php | 6 +++--- src/Transaction/MultiExec.php | 6 +++--- tests/Predis/Monitor/ConsumerTest.php | 4 ++-- tests/Predis/PubSub/ConsumerTest.php | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Monitor/Consumer.php b/src/Monitor/Consumer.php index d32fd3a5..9e62a39f 100644 --- a/src/Monitor/Consumer.php +++ b/src/Monitor/Consumer.php @@ -12,7 +12,7 @@ namespace Predis\Monitor; use Predis\ClientInterface; -use Predis\Connection\AggregateConnectionInterface; +use Predis\Connection\Cluster\ClusterInterface; use Predis\NotSupportedException; /** @@ -56,9 +56,9 @@ class Consumer implements \Iterator */ private function assertClient(ClientInterface $client) { - if ($client->getConnection() instanceof AggregateConnectionInterface) { + if ($client->getConnection() instanceof ClusterInterface) { throw new NotSupportedException( - 'Cannot initialize a monitor consumer over aggregate connections.' + 'Cannot initialize a monitor consumer over cluster connections.' ); } diff --git a/src/PubSub/Consumer.php b/src/PubSub/Consumer.php index c84ea2c3..ab6170bb 100644 --- a/src/PubSub/Consumer.php +++ b/src/PubSub/Consumer.php @@ -14,7 +14,7 @@ namespace Predis\PubSub; use Predis\ClientException; use Predis\ClientInterface; use Predis\Command\Command; -use Predis\Connection\AggregateConnectionInterface; +use Predis\Connection\Cluster\ClusterInterface; use Predis\NotSupportedException; /** @@ -62,9 +62,9 @@ class Consumer extends AbstractConsumer */ private function checkCapabilities(ClientInterface $client) { - if ($client->getConnection() instanceof AggregateConnectionInterface) { + if ($client->getConnection() instanceof ClusterInterface) { throw new NotSupportedException( - 'Cannot initialize a PUB/SUB consumer over aggregate connections.' + 'Cannot initialize a PUB/SUB consumer over cluster connections.' ); } diff --git a/src/Transaction/MultiExec.php b/src/Transaction/MultiExec.php index 0c037d9d..8c41414e 100644 --- a/src/Transaction/MultiExec.php +++ b/src/Transaction/MultiExec.php @@ -16,7 +16,7 @@ use Predis\ClientException; use Predis\ClientInterface; use Predis\Command\CommandInterface; use Predis\CommunicationException; -use Predis\Connection\AggregateConnectionInterface; +use Predis\Connection\Cluster\ClusterInterface; use Predis\NotSupportedException; use Predis\Protocol\ProtocolException; use Predis\Response\ErrorInterface as ErrorResponseInterface; @@ -66,9 +66,9 @@ class MultiExec implements ClientContextInterface */ private function assertClient(ClientInterface $client) { - if ($client->getConnection() instanceof AggregateConnectionInterface) { + if ($client->getConnection() instanceof ClusterInterface) { throw new NotSupportedException( - 'Cannot initialize a MULTI/EXEC transaction over aggregate connections.' + 'Cannot initialize a MULTI/EXEC transaction over cluster connections.' ); } diff --git a/tests/Predis/Monitor/ConsumerTest.php b/tests/Predis/Monitor/ConsumerTest.php index 15d21397..b4b95c81 100644 --- a/tests/Predis/Monitor/ConsumerTest.php +++ b/tests/Predis/Monitor/ConsumerTest.php @@ -46,9 +46,9 @@ class ConsumerTest extends PredisTestCase public function testMonitorConsumerDoesNotWorkOnClusters(): void { $this->expectException('Predis\NotSupportedException'); - $this->expectExceptionMessage('Cannot initialize a monitor consumer over aggregate connections'); + $this->expectExceptionMessage('Cannot initialize a monitor consumer over cluster connections'); - $cluster = $this->getMockBuilder('Predis\Connection\AggregateConnectionInterface')->getMock(); + $cluster = $this->getMockBuilder('Predis\Connection\Cluster\ClusterInterface')->getMock(); $client = new Client($cluster); new MonitorConsumer($client); diff --git a/tests/Predis/PubSub/ConsumerTest.php b/tests/Predis/PubSub/ConsumerTest.php index 55354a2c..e2404bbe 100644 --- a/tests/Predis/PubSub/ConsumerTest.php +++ b/tests/Predis/PubSub/ConsumerTest.php @@ -45,7 +45,7 @@ class ConsumerTest extends PredisTestCase public function testPubSubConsumerDoesNotWorkOnClusters(): void { $this->expectException('Predis\NotSupportedException'); - $this->expectExceptionMessage('Cannot initialize a PUB/SUB consumer over aggregate connections'); + $this->expectExceptionMessage('Cannot initialize a PUB/SUB consumer over cluster connections'); $cluster = $this->getMockBuilder('Predis\Connection\Cluster\ClusterInterface')->getMock(); $client = new Client($cluster);