internal static partial void FailedToDropProjectionInCopyStore(ILogger logger, ProjectionId projection, ScopeId scope);
internal static partial void ReceivedFilter(this ILogger logger, StreamId sourceStream, StreamId filter, ScopeId scope);
internal static partial void ErrorWhileRunningFilter(this ILogger logger, Exception exception, StreamId filter, ScopeId scope);
internal static partial void FilteringEventAgain(this ILogger logger, EventProcessorId filter, ScopeId scope, ArtifactId eventType, PartitionId partition, uint retryCount, FailureReason failureReason);
internal static partial void FilteredEventIsIncluded(this ILogger logger, EventProcessorId filter, ScopeId scope, ArtifactId eventType, PartitionId partition, StreamId stream);
internal static partial void ProjectionNotRegistered(ILogger logger, ProjectionId projection, ScopeId scope);
internal static partial void CreatingProjectionStatusForTenant(ILogger logger, ProjectionId projection, ScopeId scope, TenantId tenant);
/// <summary> /// Initializes a new instance of the <see cref="StreamDefinitionNotTheSameForAllTenants"/> class. /// </summary> /// <param name="scopeId">The <see cref="ScopeId" />.</param> /// <param name="streamId">The <see cref="StreamId" />.</param> public StreamDefinitionNotTheSameForAllTenants(ScopeId scopeId, StreamId streamId) : base($"The Stream Definition for Stream: '{streamId}' in Scope: '{scopeId}' is not the same for all Tenants") { }
/// <summary> /// Initializes a new instance of the <see cref="ProjectionAlreadyRegistered"/> class. /// </summary> /// <param name="scope">The scope of the Projection that was already registered.</param> /// <param name="projection">The id of the Projection that was already registered.</param> public ProjectionAlreadyRegistered(ScopeId scope, ProjectionId projection) : base($"The projection {projection} in scope {scope} is already registered") { }
/// <inheritdoc/> public Task <Try <ProjectionCurrentState> > TryGetOne(ProjectionId projection, ScopeId scope, ProjectionKey key, ExecutionContext context, CancellationToken token) => _executionContextCreator .TryCreateUsing(context) .Then(_ => _getProjectionStoreFor(_.Tenant)) .Then(_ => _.TryGet(projection, scope, key, token));
/// <inheritdoc/> public Task <Try <IAsyncEnumerable <ProjectionCurrentState> > > TryGetAll(ProjectionId projection, ScopeId scope, ExecutionContext context, CancellationToken token) => _executionContextCreator .TryCreateUsing(context) .Then(_ => _getProjectionStoreFor(_.Tenant)) .Then(_ => _.TryGetAll(projection, scope, token));
/// <inheritdoc /> public async Task <Try <ProjectionIdentifierAndScope> > Resolve(MicroserviceAddress runtime, string identifierOrAlias, ScopeId scope = null) { var projections = await _client.GetAll(runtime).ConfigureAwait(false); var matchesWithoutScope = projections.Where(projection => projection.HasAlias ? projection.Alias.Value == identifierOrAlias : projection.Id.ToString() == identifierOrAlias ).ToList(); if (matchesWithoutScope.Count == 1) { return(new ProjectionIdentifierAndScope(matchesWithoutScope[0].Id, matchesWithoutScope[0].Scope)); } scope ??= ScopeId.Default; var matchesWithScope = matchesWithoutScope.Where(projection => projection.Scope == scope).ToList(); if (matchesWithScope.Count == 1) { return(new ProjectionIdentifierAndScope(matchesWithScope[0].Id, matchesWithScope[0].Scope)); } if (matchesWithoutScope.Count > 1) { return(new MultipleProjectionsWithIdentifierOrAliasInScope(identifierOrAlias, scope, matchesWithoutScope.Count)); } return(new NoProjectionWithIdentifierOrAliasInScope(identifierOrAlias, scope)); }
static string CollectionNameForScopedSubscriptionStates(ScopeId scope) => $"x-{scope}-subscription-states";
/// <inheritdoc/> public async Task <IMongoCollection <MongoDB.Processing.Streams.EventHorizon.SubscriptionState> > Get(ScopeId scopeId, CancellationToken token) { var collection = Database.GetCollection <MongoDB.Processing.Streams.EventHorizon.SubscriptionState>(CollectionNameForScopedSubscriptionStates(scopeId)); await CreateCollectionsAndIndexesForSubscriptionStatesAsync(collection, token).ConfigureAwait(false); return(collection); }
internal static partial void GetOne(ILogger logger, ProjectionId projection, ScopeId scope);
/// <summary> /// Initializes a new instance of the <see cref="ReplayProjectionFailed"/> class. /// </summary> /// <param name="scope">The scope of the Projection.</param> /// <param name="projection">The id of the Projection.</param> /// <param name="reason">The reason why replaying the Projection failed.</param> public ReplayProjectionFailed(ScopeId scope, ProjectionId projection, string reason) : base($"Could not replay projection {projection} in scope {scope} because {reason}") { }
internal static partial void Replay(ILogger logger, ProjectionId projection, ScopeId scope);
/// <summary> /// Creates an <see cref="EventFilterWithPartitionsProcessor"/> for registering and invoking an instance of <see cref="ICanFilterEventsWithPartition"/>. /// </summary> /// <param name="id">The unique <see cref="FilterId"/> for the event filter.</param> /// <param name="scope">The <see cref="ScopeId"/> of the scope in the Event Store where the filter will run.</param> /// <param name="filter">The <see cref="ICanFilterEventsWithPartition"/> to use for filtering the events.</param> /// <returns>An <see cref="EventFilterProcessor"/> for registering and invoking an instance of <see cref="ICanFilterEventsWithPartition"/>.</returns> public EventFilterWithPartitionsProcessor GetFor(FilterId id, ScopeId scope, ICanFilterEventsWithPartition filter) => new EventFilterWithPartitionsProcessor(id, scope, _client, _reverseCallClients, filter, _converter, _loggerManager.CreateLogger <EventFilterWithPartitionsProcessor>());
internal static partial void FailedToReplayProjection(ILogger logger, ProjectionId projection, ScopeId scope, Exception exception);
/// <summary> /// Initializes a new instance of the <see cref="StreamProcessorId"/> class. /// </summary> /// <param name="scopeId">The <see cref="ScopeId" />.</param> /// <param name="eventProcessorId"><see cref="EventProcessorId"/>.</param> /// <param name="sourceStreamId">The <see cref="StreamId"/>.</param> public StreamProcessorId(ScopeId scopeId, EventProcessorId eventProcessorId, StreamId sourceStreamId) { ScopeId = scopeId; EventProcessorId = eventProcessorId; SourceStreamId = sourceStreamId; }
internal static partial void CreatingProjectionStatusForAllTenants(ILogger logger, ProjectionId projection, ScopeId scope);
/// <summary> /// Initializes an instance of the <see cref="ProjectionStateDoesNotExist" /> class. /// </summary> /// <param name="projection">The projection id.</param> /// <param name="key">The projection key.</param> /// <param name="scope">The scope id.</param> public ProjectionStateDoesNotExist(ProjectionId projection, ProjectionKey key, ScopeId scope) : base($"A projection state for projection {projection.Value} with key {key.Value} in scope {scope.Value} does not exist") { }
internal static partial void HandleFilterResult(this ILogger logger, EventProcessorId filter, ScopeId scope, ArtifactId eventType, PartitionId partition);
/// <inheritdoc/> public async Task <Try <IAsyncEnumerable <(ProjectionState State, ProjectionKey Key)> > > TryGetAll(ProjectionId projection, ScopeId scope, CancellationToken token) { try { var collection = await _projections.GetStates(scope, projection, token).ConfigureAwait(false); var states = collection .Find(Builders <Projection> .Filter.Empty) .Project(_ => new Tuple <ProjectionState, ProjectionKey>(_.ContentRaw, _.Key)) .ToAsyncEnumerable(token); var result = states.Select(_ => { return(_.Item1, _.Item2); }); return(Try <IAsyncEnumerable <(ProjectionState State, ProjectionKey Key)> > .Succeeded(result)); } catch (Exception ex) { return(ex); } }
internal static partial void FailedToFilterEvent(this ILogger logger, EventProcessorId filter, ScopeId scope, ArtifactId eventType);
/// <inheritdoc/> public Task Register <TEventType>(EventHandlerId id, ScopeId scope, bool partitioned, IEventHandler <TEventType> handler, CancellationToken cancellationToken = default) where TEventType : IEvent { _completion.RegisterHandler(id, handler.HandledEventTypes); return(_processors.GetFor(id, scope, partitioned, handler).RegisterAndHandleForeverWithPolicy(_policy, cancellationToken)); }
internal static partial void CouldNotStartFilter(this ILogger logger, StreamId filter, ScopeId scope);
public static projection_definition_builder create(ProjectionId projection, ScopeId scope) => new(projection, scope);
internal static partial void FilterStopped(this ILogger logger, StreamId filter, ScopeId scope);
internal static partial void DroppingProjection(ILogger logger, ProjectionId projection, ScopeId scope);