subscribeToAll method
Future<EventStreamSubscription>
subscribeToAll({
- LogPosition? position,
- bool resolveLinks = false,
- UserCredentials? userCredentials,
- SubscriptionFilterOptions? filterOptions,
- SubscriptionResolvedEventCallback? onEventAppeared,
- SubscriptionDroppedCallback? onSubscriptionDropped,
- EventStoreClientOperationOptions? operationOptions,
Subscribe to all ResolvedEvents.
Starting with first event after optional position
.
When position
is not given, all events from LogPosition.start
is returned. Use resolveLinks
to resolve links as ResolvedEvent
(default is false).
Callback SubscriptionResolvedEventCallback is invoked and awaited when a new event is received over the subscription.
Callback SubscriptionDroppedCallback is invoked and awaited when the subscription is dropped.
Returns as EventStreamSubscription
on first response from the server.
Implementation
Future<EventStreamSubscription> subscribeToAll({
LogPosition? position,
bool resolveLinks = false,
UserCredentials? userCredentials,
SubscriptionFilterOptions? filterOptions,
SubscriptionResolvedEventCallback? onEventAppeared,
SubscriptionDroppedCallback? onSubscriptionDropped,
EventStoreClientOperationOptions? operationOptions,
}) async {
return $runRequest<EventStreamSubscription>(() async {
final request = _setSubscriptionReq(
toReadAllReq(
position ?? LogPosition.start,
resolveLinks: resolveLinks,
),
filterOptions,
);
final client = await $getClient();
final resultStream = client.read(
request,
options: $getOptions(
userCredentials: userCredentials,
operationOptions: operationOptions,
timeoutAfter: toSubscriptionTimeout(operationOptions),
),
);
return _toSubscriptionResult(
StreamState.all(position),
resultStream,
onEventAppeared: onEventAppeared,
onSubscriptionDropped: onSubscriptionDropped,
checkpointReached: filterOptions?.checkpointReached,
);
});
}