private async Task ExecuteWorkBodyAsync(ReceivedData receivedData) { try { _logger.LogDebug( Utils.LogMessages.DataflowEngine.Execution, receivedData.DeliveryTag); if (await _workBodyAsync(receivedData).ConfigureAwait(false)) { _logger.LogDebug( Utils.LogMessages.DataflowEngine.ExecutionSuccess, receivedData.DeliveryTag); receivedData.AckMessage(); } else { _logger.LogWarning( Utils.LogMessages.DataflowEngine.ExecutionFailure, receivedData.DeliveryTag); receivedData.NackMessage(true); } } catch (Exception ex) { _logger.LogWarning( Utils.LogMessages.DataflowEngine.ExecutionError, receivedData.DeliveryTag, ex.Message); receivedData.NackMessage(true); } }
private static Task <bool> ProcessMessageAsync(ReceivedData data) { Interlocked.Increment(ref messageCount); return(Task.FromResult(data.AckMessage())); }
public Task <bool> ProcessMessageAsync(ReceivedData data) { messageCount++; return(Task.FromResult(data.AckMessage())); }
public async Task <bool> ProcessMessageAsync(ReceivedData data) { await Console.Out.WriteLineAsync(Encoding.UTF8.GetString(data.Data)); return(data.AckMessage()); }