You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying the example to subscribe to stream and enabled logging. It's trying to reconnect all the time and then fails.
Any clue as to what is going on? Trying to get simple test/example setup to run.
This is the code:
<?php
/**
* This file is part of `prooph/event-store-client`.
* (c) 2018-2020 Alexander Miertsch <kontakt@codeliner.ws>
* (c) 2018-2020 Sascha-Oliver Prolic <saschaprolic@googlemail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Prooph\EventStoreClient;
use Amp\Loop;
use Amp\Promise;
use Amp\Success;
use Prooph\EventStore\Async\EventStoreCatchUpSubscription;
use Prooph\EventStore\CatchUpSubscriptionSettings;
use Prooph\EventStore\EndPoint;
use Prooph\EventStore\ResolvedEvent;
use Prooph\EventStore\SubscriptionDropReason;
use Throwable;
require __DIR__ . '/vendor/autoload.php';
Loop::run(function () {
$builder = new ConnectionSettingsBuilder();
$builder->enableVerboseLogging();
$builder->useConsoleLogger();
$connection = EventStoreConnectionFactory::createFromEndPoint(
new EndPoint('127.0.0.1', 1113),
$builder->build()
);
$connection->onConnected(function (): void {
echo 'connected' . PHP_EOL;
});
$connection->onClosed(function (): void {
echo 'connection closed' . PHP_EOL;
});
yield $connection->connectAsync();
yield $connection->subscribeToStreamFromAsync(
'test',
null,
CatchUpSubscriptionSettings::default(),
function (EventStoreCatchUpSubscription $subscription, ResolvedEvent $resolvedEvent): Promise {
echo 'incoming event: ' . $resolvedEvent->originalEventNumber() . '@' . $resolvedEvent->originalStreamName() . PHP_EOL;
echo 'data: ' . $resolvedEvent->originalEvent()->data() . PHP_EOL;
return new Success();
},
function (EventStoreCatchUpSubscription $subscription): void {
echo 'liveProcessingStarted on ' . $subscription->streamId() . PHP_EOL;
},
function (
EventStoreCatchUpSubscription $subscription,
SubscriptionDropReason $reason,
?Throwable $exception = null
): void {
echo 'dropped with reason: ' . $reason->name() . PHP_EOL;
if ($exception) {
echo 'ex: ' . $exception->getMessage() . PHP_EOL;
}
}
);
});
Trying the example to subscribe to stream and enabled logging. It's trying to reconnect all the time and then fails.
Any clue as to what is going on? Trying to get simple test/example setup to run.
This is the code:
And the resulting output:
The text was updated successfully, but these errors were encountered: