/// <summary> /// Subscribes to the pub/sub-system and creates a new <see cref="Subscription"/> /// instance representing that subscriptions. /// </summary> /// <param name="operationContextPool"> /// The operation context pool to rent context pools for execution. /// </param> /// <param name="queryExecutor"> /// The query executor to process event payloads. /// </param> /// <param name="requestContext"> /// The original request context. /// </param> /// <param name="queryPlan"> /// The subscription query plan. /// </param> /// <param name="subscriptionType"> /// The object type that represents the subscription. /// </param> /// <param name="rootSelections"> /// The operation selection set. /// </param> /// <param name="resolveQueryRootValue"> /// A delegate to resolve the subscription instance. /// </param> /// <param name="executionDiagnosticsEvents"> /// The internal diagnostic events to report telemetry. /// </param> /// <returns> /// Returns a new subscription instance. /// </returns> public static async ValueTask <Subscription> SubscribeAsync( ObjectPool <OperationContext> operationContextPool, QueryExecutor queryExecutor, IRequestContext requestContext, QueryPlan queryPlan, ObjectType subscriptionType, ISelectionSet rootSelections, Func <object?> resolveQueryRootValue, IExecutionDiagnosticEvents executionDiagnosticsEvents) { var subscription = new Subscription( operationContextPool, queryExecutor, requestContext, queryPlan, subscriptionType, rootSelections, resolveQueryRootValue, executionDiagnosticsEvents); subscription._subscriptionScope = executionDiagnosticsEvents.ExecuteSubscription(subscription); subscription._sourceStream = await subscription.SubscribeAsync().ConfigureAwait(false); return(subscription); }
public SubscriptionSession( CancellationTokenSource session, ISocketSessionInterceptor sessionInterceptor, ISocketConnection connection, IResponseStream responseStream, ISubscription subscription, IExecutionDiagnosticEvents diagnosticEvents, string clientSubscriptionId) { _session = session ?? throw new ArgumentNullException(nameof(session)); _sessionInterceptor = sessionInterceptor ?? throw new ArgumentNullException(nameof(sessionInterceptor)); _connection = connection ?? throw new ArgumentNullException(nameof(connection)); _responseStream = responseStream ?? throw new ArgumentNullException(nameof(responseStream)); _diagnosticEvents = diagnosticEvents ?? throw new ArgumentNullException(nameof(diagnosticEvents)); Subscription = subscription ?? throw new ArgumentNullException(nameof(subscription)); Id = clientSubscriptionId ?? throw new ArgumentNullException(nameof(clientSubscriptionId)); _sessionToken = _session.Token; Task.Factory.StartNew( SendResultsAsync, _sessionToken, TaskCreationOptions.LongRunning, TaskScheduler.Default); }
public InstrumentationMiddleware( RequestDelegate next, IExecutionDiagnosticEvents diagnosticEvents) { _next = next ?? throw new ArgumentNullException(nameof(next)); _diagnosticEvents = diagnosticEvents ?? throw new ArgumentNullException(nameof(diagnosticEvents)); }
public SubscriptionExecutor( ObjectPool <OperationContext> operationContextPool, QueryExecutor queryExecutor, IExecutionDiagnosticEvents diagnosticEvents) { _operationContextPool = operationContextPool; _queryExecutor = queryExecutor; _diagnosticEvents = diagnosticEvents; }
public SubscriptionEnumerable( ISourceStream sourceStream, Func <object, Task <IQueryResult> > onEvent, Subscription subscription, IExecutionDiagnosticEvents diagnosticEvents) { _sourceStream = sourceStream; _onEvent = onEvent; _subscription = subscription; _diagnosticEvents = diagnosticEvents; }
public DocumentParserMiddleware( RequestDelegate next, IExecutionDiagnosticEvents diagnosticEvents, IDocumentHashProvider documentHashProvider) { _next = next ?? throw new ArgumentNullException(nameof(next)); _diagnosticEvents = diagnosticEvents ?? throw new ArgumentNullException(nameof(diagnosticEvents)); _documentHashProvider = documentHashProvider ?? throw new ArgumentNullException(nameof(documentHashProvider)); }
public ReadPersistedQueryMiddleware( RequestDelegate next, IExecutionDiagnosticEvents diagnosticEvents, IReadStoredQueries persistedQueryStore) { _next = next ?? throw new ArgumentNullException(nameof(next)); _diagnosticEvents = diagnosticEvents ?? throw new ArgumentNullException(nameof(diagnosticEvents)); _persistedQueryStore = persistedQueryStore ?? throw new ArgumentNullException(nameof(persistedQueryStore)); }
public DocumentValidationMiddleware( RequestDelegate next, IExecutionDiagnosticEvents diagnosticEvents, IDocumentValidator documentValidator) { _next = next ?? throw new ArgumentNullException(nameof(next)); _diagnosticEvents = diagnosticEvents ?? throw new ArgumentNullException(nameof(diagnosticEvents)); _documentValidator = documentValidator ?? throw new ArgumentNullException(nameof(documentValidator)); }
public OperationCacheMiddleware( RequestDelegate next, IExecutionDiagnosticEvents diagnosticEvents, IPreparedOperationCache operationCache) { _next = next ?? throw new ArgumentNullException(nameof(next)); _diagnosticEvents = diagnosticEvents ?? throw new ArgumentNullException(nameof(diagnosticEvents)); _operationCache = operationCache ?? throw new ArgumentNullException(nameof(operationCache)); }
public SubscriptionEnumerator( IAsyncEnumerator <object> eventEnumerator, Func <object, Task <IQueryResult> > onEvent, Subscription subscription, IExecutionDiagnosticEvents diagnosticEvents, CancellationToken requestAborted) { _eventEnumerator = eventEnumerator; _onEvent = onEvent; _subscription = subscription; _diagnosticEvents = diagnosticEvents; _requestAborted = requestAborted; }
public RegisteredExecutor( IRequestExecutor executor, IServiceProvider services, IExecutionDiagnosticEvents diagnosticEvents, RequestExecutorSetup setup, TypeModuleChangeMonitor typeModuleChangeMonitor) { Executor = executor; Services = services; DiagnosticEvents = diagnosticEvents; Setup = setup; TypeModuleChangeMonitor = typeModuleChangeMonitor; }
public DataStartMessageHandler( IRequestExecutor requestExecutor, ISocketSessionInterceptor socketSessionInterceptor, IErrorHandler errorHandler, IExecutionDiagnosticEvents diagnosticEvents) { _requestExecutor = requestExecutor ?? throw new ArgumentNullException(nameof(requestExecutor)); _socketSessionInterceptor = socketSessionInterceptor ?? throw new ArgumentNullException(nameof(socketSessionInterceptor)); _errorHandler = errorHandler ?? throw new ArgumentNullException(nameof(errorHandler)); _diagnosticEvents = diagnosticEvents ?? throw new ArgumentNullException(nameof(diagnosticEvents)); }
private Subscription( ObjectPool <OperationContext> operationContextPool, QueryExecutor queryExecutor, IRequestContext requestContext, QueryPlan queryPlan, ObjectType subscriptionType, ISelectionSet rootSelections, Func <object?> resolveQueryRootValue, IExecutionDiagnosticEvents diagnosticEvents) { unchecked { _id++; } _operationContextPool = operationContextPool; _queryExecutor = queryExecutor; _requestContext = requestContext; _queryPlan = queryPlan; _subscriptionType = subscriptionType; _rootSelections = rootSelections; _resolveQueryRootValue = resolveQueryRootValue; _diagnosticEvents = diagnosticEvents; }