mirror of
https://github.com/predis/predis.git
synced 2026-08-30 20:21:31 +00:00
Allow PubSub / MultiExec with Replication
This commit is contained in:
committed by
Till Krüss
parent
15244c9642
commit
e5221fa13b
@@ -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.'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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.'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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.'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user