async Task IFilter <ModelContext> .Send(ModelContext context, IPipe <ModelContext> next) { var receiveSettings = context.GetPayload <ReceiveSettings>(); var inputAddress = context.ConnectionContext.HostSettings.GetInputAddress(receiveSettings); using (ITaskScope scope = _supervisor.CreateScope($"{TypeMetadataCache<RabbitMqConsumerFilter>.ShortName} - {inputAddress}", () => TaskUtil.Completed)) { var consumer = new RabbitMqBasicConsumer(context, inputAddress, _receivePipe, _receiveObserver, scope); await context.BasicConsume(receiveSettings.QueueName, false, consumer).ConfigureAwait(false); await scope.Ready.ConfigureAwait(false); await _endpointObserver.Ready(new Ready(inputAddress)).ConfigureAwait(false); scope.SetReady(); try { await scope.Completed.ConfigureAwait(false); } finally { RabbitMqConsumerMetrics metrics = consumer; await _endpointObserver.Completed(new Completed(inputAddress, metrics)).ConfigureAwait(false); if (_log.IsDebugEnabled) { _log.DebugFormat("Consumer {0}: {1} received, {2} concurrent", metrics.ConsumerTag, metrics.DeliveryCount, metrics.ConcurrentDeliveryCount); } } } }
public void Connected(RabbitMqConnectionContext connectionContext) { _connectionContext.TrySetResult(connectionContext); _taskScope.SetReady(); }
public void Created(RabbitMqModelContext connectionContext) { _modelContext.TrySetResult(connectionContext); _taskScope.SetReady(); }
public void Connected(HttpOwinHostContext hostContext) { _owinHostContext.TrySetResult(hostContext); _taskScope.SetReady(); }
public void Created(HttpClientContext clientContext) { _clientContext.TrySetResult(clientContext); _taskScope.SetReady(); }