/// <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="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="diagnosticsEvents"> /// 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, ObjectType subscriptionType, ISelectionSet rootSelections, Func <object?> resolveQueryRootValue, IDiagnosticEvents diagnosticsEvents) { var subscription = new Subscription( operationContextPool, queryExecutor, requestContext, subscriptionType, rootSelections, resolveQueryRootValue, diagnosticsEvents); subscription._subscriptionScope = diagnosticsEvents.ExecuteSubscription(subscription); subscription._sourceStream = await subscription.SubscribeAsync().ConfigureAwait(false); return(subscription); }
public SubscriptionExecutor( ObjectPool <OperationContext> operationContextPool, QueryExecutor queryExecutor, IExecutionDiagnosticEvents diagnosticEvents) { _operationContextPool = operationContextPool; _queryExecutor = queryExecutor; _diagnosticEvents = diagnosticEvents; }
private Subscription( ObjectPool <OperationContext> operationContextPool, QueryExecutor queryExecutor, IRequestContext requestContext, ObjectType subscriptionType, ISelectionSet rootSelections, IDiagnosticEvents diagnosticEvents) { _operationContextPool = operationContextPool; _queryExecutor = queryExecutor; _requestContext = requestContext; _subscriptionType = subscriptionType; _rootSelections = rootSelections; _diagnosticEvents = diagnosticEvents; }
public static async ValueTask <Subscription> SubscribeAsync( ObjectPool <OperationContext> operationContextPool, QueryExecutor queryExecutor, IRequestContext requestContext, ObjectType subscriptionType, ISelectionSet rootSelections, IDiagnosticEvents diagnosicEvents) { var subscription = new Subscription( operationContextPool, queryExecutor, requestContext, subscriptionType, rootSelections, diagnosicEvents); subscription._sourceStream = await subscription.SubscribeAsync(); return(subscription); }
private Subscription( ObjectPool <OperationContext> operationContextPool, QueryExecutor queryExecutor, IRequestContext requestContext, ObjectType subscriptionType, ISelectionSet rootSelections, Func <object?> resolveQueryRootValue, IDiagnosticEvents diagnosticEvents) { unchecked { _id++; } _operationContextPool = operationContextPool; _queryExecutor = queryExecutor; _requestContext = requestContext; _subscriptionType = subscriptionType; _rootSelections = rootSelections; _resolveQueryRootValue = resolveQueryRootValue; _diagnosticEvents = diagnosticEvents; }