public async Task ProcessAsync(IClientPipeContext context, ReadOnlyMemory <IClientPipe> pipeline) { using var channelContainer = await _connectionManager.AcquireChannel(_channelType); try { context.ChannelContainer = channelContainer; await ProcessNextAsync(context, pipeline); } finally { context.ChannelContainer = null; } }
public async Task ProcessAsync(IClientPipeContext context, ReadOnlyMemory <IClientPipe> pipeline) { var channelContainer = await _connectionManager.AcquireChannel(_channelType); try { context.ChannelContainer = channelContainer; await ProcessNextAsync(context, pipeline); } catch { // Do not release channel except on error context.ChannelContainer = null; channelContainer.Dispose(); throw; } }
public static Task ExecutePipelineAsync(IClientPipeContext context, ReadOnlyMemory <IClientPipe> pipeline) { var pipe = pipeline.Span[0]; if (pipe is IGenericClientPipe genericPipe) { return(genericPipe.ProcessAsync(context, pipeline.Slice(1))); } if (context is ClientPipeContextAction contextAction && pipe is IActionClientPipe actionPipe) { return(actionPipe.ProcessAsync(contextAction, pipeline.Slice(1))); } if (context is ClientPipeContextMessage contextMessage && pipe is IMessageClientPipe messagePipe) { return(messagePipe.ProcessAsync(contextMessage, pipeline.Slice(1))); } throw new RabbitMqPipeException($"Unsupported message of type {context.GetType()} for pipe {pipeline.GetType()}"); }
protected Task ProcessNextAsync(IClientPipeContext context, ReadOnlyMemory <IClientPipe> pipeline) { return(ExecutePipelineAsync(context, pipeline)); }
public async Task ProcessAsync(IClientPipeContext context, ReadOnlyMemory <IClientPipe> pipeline) { await _connectionRetryUtil.ExecuteWithRetryOnErrorsAsync(() => ProcessNextAsync(context, pipeline)); }
public static bool TryGetOptionalItemValue <T>(this IClientPipeContext context, string key, out T value) { value = default !;