public void Initialize( IBatchDispatcher batchDispatcher, CancellationToken requestAborted) { _completed = new CancellationTokenSource(); requestAborted.Register(TryComplete); BatchDispatcher = batchDispatcher; BatchDispatcher.TaskEnqueued += BatchDispatcherEventHandler; }
public void Initialize( IBatchDispatcher batchDispatcher, CancellationToken requestAborted) { _taskStatistics.Clear(); _completed = new CancellationTokenSource(); requestAborted.Register(TryComplete); _batchDispatcher = batchDispatcher; _batchDispatcher.TaskEnqueued += BatchDispatcherEventHandler; _isPooled = false; }
public void Initialize( IRequestContext requestContext, IServiceProvider scopedServices, IBatchDispatcher batchDispatcher, IPreparedOperation operation, object?rootValue, IVariableValueCollection variables) { _requestContext = requestContext; _executionContext.Initialize( batchDispatcher, requestContext.RequestAborted); Operation = operation; RootValue = rootValue; Variables = variables; Services = scopedServices; }
private async Task <IQueryResult> OnEvent(object payload) { using IServiceScope serviceScope = _requestContext.Services.CreateScope(); IServiceProvider eventServices = serviceScope.ServiceProvider; IBatchDispatcher dispatcher = eventServices.GetRequiredService <IBatchDispatcher>(); OperationContext operationContext = _operationContextPool.Get(); try { ImmutableDictionary <string, object?> scopedContext = ImmutableDictionary <string, object?> .Empty .SetItem(WellKnownContextData.EventMessage, payload); object?rootValue = RootValueResolver.Resolve( _requestContext, eventServices, _subscriptionType, ref _cachedRootValue); operationContext.Initialize( _requestContext, eventServices, dispatcher, _requestContext.Operation !, _requestContext.Variables !, rootValue, _resolveQueryRootValue); return(await _queryExecutor .ExecuteAsync(operationContext, scopedContext) .ConfigureAwait(false)); } finally { _operationContextPool.Return(operationContext); } }
public void Clean() { if (_batchDispatcher is not null !) { _batchDispatcher.TaskEnqueued -= BatchDispatcherEventHandler; _batchDispatcher = default !;
public async ValueTask InvokeAsync( IRequestContext context, IBatchDispatcher batchDispatcher) { if (context.Operation is { } && context.Variables is { })