public Receiver(MessageReceiver messageReceiver, Uri inputAddress, IPipe <ReceiveContext> receivePipe, ReceiveSettings receiveSettings, IReceiveObserver receiveObserver, ITaskSupervisor supervisor) { _messageReceiver = messageReceiver; _inputAddress = inputAddress; _receivePipe = receivePipe; _receiveSettings = receiveSettings; _receiveObserver = receiveObserver; _supervisor = supervisor; _participant = supervisor.CreateParticipant(); var options = new OnMessageOptions { AutoComplete = false, AutoRenewTimeout = receiveSettings.AutoRenewTimeout, MaxConcurrentCalls = receiveSettings.MaxConcurrentCalls }; options.ExceptionReceived += (sender, x) => { if (_log.IsErrorEnabled) { _log.Error($"Exception received on receiver: {_inputAddress} during {x.Action}", x.Exception); } _participant.SetComplete(); }; messageReceiver.OnMessageAsync(OnMessage, options); _participant.SetReady(); SetupStopTask(); }
public Receiver(MessageReceiver messageReceiver, Uri inputAddress, IPipe<ReceiveContext> receivePipe, ReceiveSettings receiveSettings, IReceiveObserver receiveObserver, ITaskSupervisor supervisor) { _messageReceiver = messageReceiver; _inputAddress = inputAddress; _receivePipe = receivePipe; _receiveSettings = receiveSettings; _receiveObserver = receiveObserver; _supervisor = supervisor; _participant = supervisor.CreateParticipant(); var options = new OnMessageOptions { AutoComplete = false, AutoRenewTimeout = receiveSettings.AutoRenewTimeout, MaxConcurrentCalls = receiveSettings.MaxConcurrentCalls }; options.ExceptionReceived += (sender, x) => { if (_log.IsErrorEnabled) _log.Error($"Exception received on receiver: {_inputAddress} during {x.Action}", x.Exception); _participant.SetComplete(); }; messageReceiver.OnMessageAsync(OnMessage, options); _participant.SetReady(); SetupStopTask(); }
public SharedModelContext(ModelContext context, CancellationToken cancellationToken, ITaskScope scope) { _context = context; _cancellationToken = cancellationToken; _participant = scope.CreateParticipant($"{TypeMetadataCache<SharedModelContext>.ShortName} - {context.ConnectionContext.HostSettings.ToDebugString()}"); _participant.SetReady(); }
public SharedHttpOwinHostContext(OwinHostContext context, CancellationToken cancellationToken, ITaskSupervisor scope) { _context = context; CancellationToken = cancellationToken; _participant = scope.CreateParticipant($"{TypeMetadataCache<SharedHttpOwinHostContext>.ShortName} - {context.HostSettings.ToDebugString()}"); _participant.SetReady(); }
public SharedConnectionContext(ConnectionContext context, CancellationToken cancellationToken, ITaskScope scope) { _context = context; _cancellationToken = cancellationToken; _participant = scope.CreateParticipant($"{TypeMetadataCache<SharedConnectionContext>.ShortName} - {context.Description}"); _participant.SetReady(); }
public SharedHttpClientContext(ClientContext context, CancellationToken cancellationToken, ITaskScope scope) { _context = context; _cancellationToken = cancellationToken; _participant = scope.CreateParticipant($"{TypeMetadataCache<SharedHttpClientContext>.ShortName} - {context.BaseAddress}"); _participant.SetReady(); }
/// <summary> /// Called when the consumer is ready to be delivered messages by the broker /// </summary> /// <param name="consumerTag"></param> void IBasicConsumer.HandleBasicConsumeOk(string consumerTag) { if (_log.IsDebugEnabled) { _log.DebugFormat("ConsumerOk: {0} - {1}", _inputAddress, consumerTag); } _consumerTag = consumerTag; _participant.SetReady(); }
public HttpConsumerAction(IReceiveObserver receiveObserver, HttpHostSettings settings, IPipe <ReceiveContext> receivePipe, ITaskScope taskSupervisor, IHttpReceiveEndpointTopology topology) { _receiveObserver = receiveObserver; _receivePipe = receivePipe; _topology = topology; _tracker = new DeliveryTracker(OnDeliveryComplete); _inputAddress = settings.GetInputAddress(); _participant = taskSupervisor.CreateParticipant($"{TypeMetadataCache<HttpConsumerAction>.ShortName} - {_inputAddress}", Stop); _deliveryComplete = new TaskCompletionSource <bool>(); _participant.SetReady(); }
HttpOwinHostContext(HttpHostSettings settings, ITaskParticipant participant) : base(new PayloadCache(), participant.StoppedToken) { HostSettings = settings; _participant = participant; _endpoints = new SortedDictionary <string, List <Endpoint> >(StringComparer.OrdinalIgnoreCase); _options = new StartOptions { Port = HostSettings.Port }; _options.Urls.Add(HostSettings.Host); _participant.SetReady(); }
HttpOwinHostContext(HttpHostSettings settings, ITaskParticipant participant) : base(new PayloadCache(), participant.StoppedToken) { HostSettings = settings; _participant = participant; _endpoints = new SortedDictionary<string, List<Endpoint>>(StringComparer.OrdinalIgnoreCase); _options = new StartOptions { Port = HostSettings.Port }; _options.Urls.Add(HostSettings.Host); _participant.SetReady(); }
public Receiver(NamespaceContext context, ClientContext clientContext, IPipe <ReceiveContext> receivePipe, ClientSettings clientSettings, ITaskSupervisor supervisor, ISendEndpointProvider sendEndpointProvider, IPublishEndpointProvider publishEndpointProvider) { _context = context; _clientContext = clientContext; _receivePipe = receivePipe; _clientSettings = clientSettings; _sendEndpointProvider = sendEndpointProvider; _publishEndpointProvider = publishEndpointProvider; _tracker = new DeliveryTracker(DeliveryComplete); _participant = supervisor.CreateParticipant($"{TypeMetadataCache<Receiver>.ShortName} - {clientContext.InputAddress}", Stop); var options = new OnMessageOptions { AutoComplete = false, AutoRenewTimeout = clientSettings.AutoRenewTimeout, MaxConcurrentCalls = clientSettings.MaxConcurrentCalls }; options.ExceptionReceived += (sender, x) => { if (!(x.Exception is OperationCanceledException)) { if (_log.IsErrorEnabled) { _log.Error($"Exception received on receiver: {clientContext.InputAddress} during {x.Action}", x.Exception); } } if (_tracker.ActiveDeliveryCount == 0) { if (_log.IsDebugEnabled) { _log.DebugFormat("Receiver shutdown completed: {0}", clientContext.InputAddress); } _participant.SetComplete(); } }; clientContext.OnMessageAsync(OnMessage, options); _participant.SetReady(); }
public SessionReceiver(QueueClient queueClient, Uri inputAddress, IPipe <ReceiveContext> receivePipe, ReceiveSettings receiveSettings, IReceiveObserver receiveObserver, ITaskSupervisor supervisor) { _queueClient = queueClient; _inputAddress = inputAddress; _receivePipe = receivePipe; _receiveSettings = receiveSettings; _receiveObserver = receiveObserver; _participant = supervisor.CreateParticipant($"{TypeMetadataCache<Receiver>.ShortName} - {inputAddress}", Stop); var options = new SessionHandlerOptions { AutoComplete = false, AutoRenewTimeout = receiveSettings.AutoRenewTimeout, MaxConcurrentSessions = receiveSettings.MaxConcurrentCalls, MessageWaitTimeout = receiveSettings.MessageWaitTimeout }; options.ExceptionReceived += (sender, x) => { if (!(x.Exception is OperationCanceledException)) { if (_log.IsErrorEnabled) { _log.Error($"Exception received on session receiver: {_inputAddress} during {x.Action}", x.Exception); } } if (_currentPendingDeliveryCount == 0) { if (_log.IsDebugEnabled) { _log.DebugFormat("Session receiver shutdown completed: {0}", _inputAddress); } _participant.SetComplete(); } }; IMessageSessionAsyncHandlerFactory handlerFactory = new MessageSessionAsyncHandlerFactory(supervisor, this); queueClient.RegisterSessionHandlerFactoryAsync(handlerFactory, options); _participant.SetReady(); }
public Receiver(ConnectionContext context, MessageReceiver messageReceiver, Uri inputAddress, IPipe <ReceiveContext> receivePipe, ReceiveSettings receiveSettings, IReceiveObserver receiveObserver, ITaskSupervisor supervisor) { _context = context; _messageReceiver = messageReceiver; _inputAddress = inputAddress; _receivePipe = receivePipe; _receiveSettings = receiveSettings; _receiveObserver = receiveObserver; _participant = supervisor.CreateParticipant($"{TypeMetadataCache<Receiver>.ShortName} - {inputAddress}", Stop); var options = new OnMessageOptions { AutoComplete = false, AutoRenewTimeout = receiveSettings.AutoRenewTimeout, MaxConcurrentCalls = receiveSettings.MaxConcurrentCalls }; options.ExceptionReceived += (sender, x) => { if (!(x.Exception is OperationCanceledException)) { if (_log.IsErrorEnabled) { _log.Error($"Exception received on receiver: {_inputAddress} during {x.Action}", x.Exception); } } if (_currentPendingDeliveryCount == 0) { if (_log.IsDebugEnabled) { _log.DebugFormat("Receiver shutdown completed: {0}", _inputAddress); } _participant.SetComplete(); } }; messageReceiver.OnMessageAsync(OnMessage, options); _participant.SetReady(); }
public HttpConsumerAction(IReceiveObserver receiveObserver, HttpHostSettings settings, ReceiveSettings receiveSettings, IPipe<ReceiveContext> receivePipe, ITaskScope taskSupervisor, ISendPipe sendPipe) { _receiveObserver = receiveObserver; _receiveSettings = receiveSettings; _receivePipe = receivePipe; _sendPipe = sendPipe; _tracker = new DeliveryTracker(OnDeliveryComplete); _inputAddress = settings.GetInputAddress(); _participant = taskSupervisor.CreateParticipant($"{TypeMetadataCache<HttpConsumerAction>.ShortName} - {_inputAddress}", Stop); _deliveryComplete = new TaskCompletionSource<bool>(); _participant.SetReady(); }
public Receiver(NamespaceContext context, ClientContext clientContext, IPipe<ReceiveContext> receivePipe, ClientSettings clientSettings, ITaskSupervisor supervisor, ISendEndpointProvider sendEndpointProvider, IPublishEndpointProvider publishEndpointProvider) { _context = context; _clientContext = clientContext; _receivePipe = receivePipe; _clientSettings = clientSettings; _sendEndpointProvider = sendEndpointProvider; _publishEndpointProvider = publishEndpointProvider; _tracker = new DeliveryTracker(DeliveryComplete); _participant = supervisor.CreateParticipant($"{TypeMetadataCache<Receiver>.ShortName} - {clientContext.InputAddress}", Stop); var options = new OnMessageOptions { AutoComplete = false, AutoRenewTimeout = clientSettings.AutoRenewTimeout, MaxConcurrentCalls = clientSettings.MaxConcurrentCalls }; options.ExceptionReceived += (sender, x) => { if (!(x.Exception is OperationCanceledException)) { if (_log.IsErrorEnabled) _log.Error($"Exception received on receiver: {clientContext.InputAddress} during {x.Action}", x.Exception); } if (_tracker.ActiveDeliveryCount == 0) { if (_log.IsDebugEnabled) _log.DebugFormat("Receiver shutdown completed: {0}", clientContext.InputAddress); _participant.SetComplete(); } }; clientContext.OnMessageAsync(OnMessage, options); _participant.SetReady(); }
public Receiver(ConnectionContext context, MessageReceiver messageReceiver, Uri inputAddress, IPipe<ReceiveContext> receivePipe, ReceiveSettings receiveSettings, IReceiveObserver receiveObserver, ITaskSupervisor supervisor) { _context = context; _messageReceiver = messageReceiver; _inputAddress = inputAddress; _receivePipe = receivePipe; _receiveSettings = receiveSettings; _receiveObserver = receiveObserver; _participant = supervisor.CreateParticipant($"{TypeMetadataCache<Receiver>.ShortName} - {inputAddress}", Stop); var options = new OnMessageOptions { AutoComplete = false, AutoRenewTimeout = receiveSettings.AutoRenewTimeout, MaxConcurrentCalls = receiveSettings.MaxConcurrentCalls }; options.ExceptionReceived += (sender, x) => { if (!(x.Exception is OperationCanceledException)) { if (_log.IsErrorEnabled) _log.Error($"Exception received on receiver: {_inputAddress} during {x.Action}", x.Exception); } if (_currentPendingDeliveryCount == 0) { if (_log.IsDebugEnabled) _log.DebugFormat("Receiver shutdown completed: {0}", _inputAddress); _participant.SetComplete(); } }; messageReceiver.OnMessageAsync(OnMessage, options); _participant.SetReady(); }
public async Task Start(NamespaceContext context) { var options = new SessionHandlerOptions { AutoComplete = false, AutoRenewTimeout = _clientSettings.AutoRenewTimeout, MaxConcurrentSessions = _clientSettings.MaxConcurrentCalls, MessageWaitTimeout = _clientSettings.MessageWaitTimeout }; options.ExceptionReceived += (sender, x) => { if (!(x.Exception is OperationCanceledException)) { if (_log.IsErrorEnabled) { _log.Error($"Exception received on session receiver: {_clientContext.InputAddress} during {x.Action}", x.Exception); } } if (_tracker.ActiveDeliveryCount == 0) { if (_log.IsDebugEnabled) { _log.DebugFormat("Session receiver shutdown completed: {0}", _clientContext.InputAddress); } _participant.SetComplete(); } }; IMessageSessionAsyncHandlerFactory handlerFactory = new MessageSessionAsyncHandlerFactory(context, _supervisor, this, _tracker, _topology); await _clientContext.RegisterSessionHandlerFactoryAsync(handlerFactory, options).ConfigureAwait(false); _participant.SetReady(); }
RabbitMqModelContext(ConnectionContext connectionContext, IModel model, IRabbitMqHost host, ITaskParticipant participant) : base(new PayloadCacheScope(connectionContext)) { _connectionContext = connectionContext; _model = model; _host = host; _participant = participant; _published = new ConcurrentDictionary<ulong, PendingPublish>(); _taskScheduler = new LimitedConcurrencyLevelTaskScheduler(1); _model.ModelShutdown += OnModelShutdown; _model.BasicAcks += OnBasicAcks; _model.BasicNacks += OnBasicNacks; _model.BasicReturn += OnBasicReturn; if (host.Settings.PublisherConfirmation) { _model.ConfirmSelect(); } _participant.SetReady(); }
RabbitMqModelContext(ConnectionContext connectionContext, IModel model, ModelSettings settings, ITaskParticipant participant) : base(new PayloadCacheScope(connectionContext)) { _connectionContext = connectionContext; _model = model; _settings = settings; _participant = participant; _published = new ConcurrentDictionary <ulong, PendingPublish>(); _taskScheduler = new LimitedConcurrencyLevelTaskScheduler(1); _model.ModelShutdown += OnModelShutdown; _model.BasicAcks += OnBasicAcks; _model.BasicNacks += OnBasicNacks; _model.BasicReturn += OnBasicReturn; if (settings.PublisherConfirmation) { _model.ConfirmSelect(); } _participant.SetReady(); }
public SessionReceiver(ConnectionContext context, QueueClient queueClient, Uri inputAddress, IPipe<ReceiveContext> receivePipe, ReceiveSettings receiveSettings, IReceiveObserver receiveObserver, ITaskSupervisor supervisor) { _queueClient = queueClient; _inputAddress = inputAddress; _receivePipe = receivePipe; _receiveSettings = receiveSettings; _receiveObserver = receiveObserver; _participant = supervisor.CreateParticipant($"{TypeMetadataCache<Receiver>.ShortName} - {inputAddress}", Stop); var options = new SessionHandlerOptions { AutoComplete = false, AutoRenewTimeout = receiveSettings.AutoRenewTimeout, MaxConcurrentSessions = receiveSettings.MaxConcurrentCalls, MessageWaitTimeout = receiveSettings.MessageWaitTimeout }; options.ExceptionReceived += (sender, x) => { if (!(x.Exception is OperationCanceledException)) { if (_log.IsErrorEnabled) _log.Error($"Exception received on session receiver: {_inputAddress} during {x.Action}", x.Exception); } if (_currentPendingDeliveryCount == 0) { if (_log.IsDebugEnabled) _log.DebugFormat("Session receiver shutdown completed: {0}", _inputAddress); _participant.SetComplete(); } }; IMessageSessionAsyncHandlerFactory handlerFactory = new MessageSessionAsyncHandlerFactory(context, supervisor, this); queueClient.RegisterSessionHandlerFactoryAsync(handlerFactory, options); _participant.SetReady(); }
void ITaskParticipant.SetReady() { _participant.SetReady(); }