예제 #1
0
        public async Task <PollResponse> Handle(IEnumerable <QueryParameter> parameters, CancellationToken cancellationToken)
        {
            foreach (var parameter in parameters)
            {
                ApplyParameter(parameter);
            }

            var result = await _eventFetcher.Fetch(cancellationToken);

            CheckEventCountRestriction(result);

            return(new PollResponse
            {
                QueryName = Name,
                EventList = result.ToArray()
            });
        }
예제 #2
0
        public async Task <PollResponse> Handle(QueryParameter[] parameters, CancellationToken cancellationToken)
        {
            foreach (var parameter in parameters)
            {
                if (IsSimpleParameter(parameter, out Action <IEventFetcher, QueryParameter> action) || IsRegexParameter(parameter, out action))
                {
                    ApplyParameter(action, parameter);
                }
                else
                {
                    throw new NotImplementedException($"Query parameter unexpected or not implemented: '{parameter.Name}'");
                }
            }

            var result = await _eventFetcher.Fetch(cancellationToken);

            return(new PollResponse
            {
                QueryName = Name,
                EventList = result.ToArray()
            });
        }