Ejemplo n.º 1
0
    async Task <IFilterResult> Filter(FilterEventRequest request, ExecutionContext executionContext, CancellationToken cancellationToken)
    {
        var response = await _dispatcher.Call(request, executionContext, cancellationToken).ConfigureAwait(false);

        return(response switch
        {
            { Failure : null } => new SuccessfulFiltering(response.IsIncluded, response.PartitionId),
Ejemplo n.º 2
0
    /// <inheritdoc/>
    public override Task <IFilterResult> Filter(CommittedEvent @event, PartitionId partitionId, EventProcessorId eventProcessorId, ExecutionContext executionContext, CancellationToken cancellationToken)
    {
        var request = new FilterEventRequest
        {
            Event   = @event.ToProtobuf(),
            ScopeId = Scope.ToProtobuf()
        };

        return(Filter(request, executionContext, cancellationToken));
    }
Ejemplo n.º 3
0
        public async Task <IActionResult> Search(FilterEventRequest filter)
        {
            var filteredEvents = await _eventService.GetEventsByFilter(filter.Place, filter.Date, filter.EventType);

            var cities = GetAllCities();

            return(View(new HomeViewModel()
            {
                Events = filteredEvents, Cities = cities
            }));
        }
Ejemplo n.º 4
0
        /// <inheritdoc/>
        public override Task <IFilterResult> Filter(CommittedEvent @event, PartitionId partitionId, EventProcessorId eventProcessorId, CancellationToken cancellationToken)
        {
            _logger.Debug("Filter event that occurred @ {Occurred}", @event.Occurred);

            var request = new FilterEventRequest
            {
                Event   = @event.ToProtobuf(),
                ScopeId = Scope.ToProtobuf()
            };

            return(Filter(request, cancellationToken));
        }
Ejemplo n.º 5
0
    /// <inheritdoc/>
    public override Task <IFilterResult> Filter(CommittedEvent @event, PartitionId partitionId, EventProcessorId eventProcessorId, string failureReason, uint retryCount, ExecutionContext executionContext, CancellationToken cancellationToken)
    {
        var request = new FilterEventRequest
        {
            Event   = @event.ToProtobuf(),
            ScopeId = Scope.ToProtobuf(),
            RetryProcessingState = new RetryProcessingState {
                FailureReason = failureReason, RetryCount = retryCount
            }
        };

        return(Filter(request, executionContext, cancellationToken));
    }
Ejemplo n.º 6
0
    /// <inheritdoc/>
    public override Task <IFilterResult> Filter(CommittedEvent @event, PartitionId partitionId, EventProcessorId eventProcessorId, ExecutionContext executionContext, CancellationToken cancellationToken)
    {
        if ([email protected])
        {
            return(Task.FromResult <IFilterResult>(new SuccessfulFiltering(false, PartitionId.None)));
        }
        var request = new FilterEventRequest
        {
            Event   = @event.ToProtobuf(),
            ScopeId = Scope.ToProtobuf()
        };

        return(Filter(request, executionContext, cancellationToken));
    }
Ejemplo n.º 7
0
        /// <inheritdoc/>
        protected override Task <TFilterResponse> Handle(FilterEventRequest request, CancellationToken cancellationToken)
        {
            try
            {
                var committed = _converter.ToSDK(request.Event);
                if (committed.Event is TEventType typedEvent)
                {
                    return(Filter(typedEvent, committed.DeriveContext()));
                }

                throw new EventTypeIsIncorrectForFilter(typeof(TEventType), committed.Event.GetType());
            }
            catch (CouldNotDeserializeEvent ex)
            {
                throw new CouldNotDeserializeEventFromScope(request.ScopeId.To <ScopeId>(), ex);
            }
        }
Ejemplo n.º 8
0
        /// <inheritdoc/>
        public override Task <IFilterResult> Filter(CommittedEvent @event, PartitionId partitionId, EventProcessorId eventProcessorId, CancellationToken cancellationToken)
        {
            _logger.Debug(
                "Filter event that occurred @ {Occurred} to public events stream '{TargetStream}'",
                @event.Occurred,
                Definition.TargetStream);
            if ([email protected])
            {
                return(Task.FromResult <IFilterResult>(new SuccessfulFiltering(false, Guid.Empty)));
            }
            var request = new FilterEventRequest
            {
                Event   = @event.ToProtobuf(),
                ScopeId = Scope.ToProtobuf()
            };

            return(Filter(request, cancellationToken));
        }
Ejemplo n.º 9
0
        /// <inheritdoc/>
        public override Task <IFilterResult> Filter(CommittedEvent @event, PartitionId partitionId, EventProcessorId eventProcessorId, string failureReason, uint retryCount, CancellationToken cancellationToken)
        {
            _logger.Debug(
                "Filter event that occurred @ {Occurred} again for the {RetryCount}. time because: {FailureReason}",
                @event.Occurred,
                retryCount,
                failureReason);

            var request = new FilterEventRequest
            {
                Event   = @event.ToProtobuf(),
                ScopeId = Scope.ToProtobuf(),
                RetryProcessingState = new RetryProcessingState {
                    FailureReason = failureReason, RetryCount = retryCount
                }
            };

            return(Filter(request, cancellationToken));
        }
Ejemplo n.º 10
0
        /// <inheritdoc/>
        public override Task <IFilterResult> Filter(CommittedEvent @event, PartitionId partitionId, EventProcessorId eventProcessorId, string failureReason, uint retryCount, CancellationToken cancellationToken)
        {
            _logger.Debug(
                "Filter event that occurred @ {Occurred} to public events stream '{TargetStream}' again for the {RetryCount}. time because: {FailureReason}",
                @event.Occurred,
                Definition.TargetStream,
                retryCount,
                failureReason);
            if ([email protected])
            {
                return(Task.FromResult <IFilterResult>(new SuccessfulFiltering(false, Guid.Empty)));
            }
            var request = new FilterEventRequest
            {
                Event   = @event.ToProtobuf(),
                ScopeId = Scope.ToProtobuf(),
                RetryProcessingState = new RetryProcessingState {
                    FailureReason = failureReason, RetryCount = retryCount
                }
            };

            return(Filter(request, cancellationToken));
        }
Ejemplo n.º 11
0
 /// <inheritdoc/>
 public void SetRequestContext(ReverseCallRequestContext context, FilterEventRequest request)
 => request.CallContext = context;
Ejemplo n.º 12
0
 /// <inheritdoc/>
 public void SetRequest(FilterEventRequest request, FilterRuntimeToClientMessage message)
 => message.FilterRequest = request;
Ejemplo n.º 13
0
 /// <inheritdoc/>
 protected override RetryProcessingState GetRetryProcessingState(FilterEventRequest request)
 => request.RetryProcessingState;