Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

performOnMasterOnly property doesn't seem to work #167

Open
tomtimmerman opened this issue Jul 5, 2022 · 4 comments
Open

performOnMasterOnly property doesn't seem to work #167

tomtimmerman opened this issue Jul 5, 2022 · 4 comments

Comments

@tomtimmerman
Copy link

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

@prolic
Copy link
Member

prolic commented Jul 8, 2022

Please paste your connection string

@tomtimmerman
Copy link
Author

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.

@prolic
Copy link
Member

prolic commented Jul 13, 2022

I try to get to it this weekend.

@prolic
Copy link
Member

prolic commented Jun 14, 2024

RequireMaster=true only has an effect upon appending events to a stream, not upon connecting. Try using preferRandomNode on the ClusterSettings and you should be able to connect to a random node.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants