event-store-client icon indicating copy to clipboard operation
event-store-client copied to clipboard

performOnMasterOnly property doesn't seem to work

Open tomtimmerman opened this issue 3 years ago • 4 comments
trafficstars

Hi

I'am trying to create a persistent subscription to a eventstore cluster version 21.10.5. I've set the performOnMasterOnly property but it only tries to connect to follower nodes not to the leader node. The ClusterDnsEndPointDiscoverer always returns the first node it encounters and not the master node. Below is my client config.

$userCredentials = new UserCredentials($username, $password);
$connectionSettings = ConnectionSettings::create()
    ->setDefaultUserCredentials($userCredentials)
    ->useSslConnection($host, $useSsl)
    ->enableVerboseLogging()
    ->performOnMasterOnly()
    ->build();

$connection = EventStoreConnectionFactory::createFromConnectionString($connectionString, $connectionSettings);

Loop::run( function () use ($connection) {
    yield $connection->connectAsync();
    yield $connection->connectToPersistentSubscriptionAsync(
        'stream-id',
        'subscription-name',
        Closure::fromCallable(static function (EventStorePersistentSubscription $subscription, ResolvedEvent $resolvedEvent): Promise {
            echo 'received event!';
            return new Success();
        }),
        Closure::fromCallable(static function (EventStorePersistentSubscription $subscription, SubscriptionDropReason $reason, Throwable $throwable = null): void {
            echo 'subscription dropped.';
        }),
        1,
        true 
    );
} );

Thanks

tomtimmerman avatar Jul 05 '22 08:07 tomtimmerman

Please paste your connection string

prolic avatar Jul 08 '22 17:07 prolic

This is my connection string: GossipSeeds=<clusterId>-0.mesdb.eventstore.cloud:2113,<clusterId>-1.mesdb.eventstore.cloud:2113,<clusterId>-2.mesdb.eventstore.cloud:2113;UseSslConnection=true

Is also tried with the RequireMaster=true but have the same problem.

tomtimmerman avatar Jul 12 '22 07:07 tomtimmerman

I try to get to it this weekend.

prolic avatar Jul 13 '22 04:07 prolic