Beispiel #1
0
        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);
            }
        }
Beispiel #2
0
 private static Task <bool> ProcessMessageAsync(ReceivedData data)
 {
     Interlocked.Increment(ref messageCount);
     return(Task.FromResult(data.AckMessage()));
 }
Beispiel #3
0
 public Task <bool> ProcessMessageAsync(ReceivedData data)
 {
     messageCount++;
     return(Task.FromResult(data.AckMessage()));
 }
Beispiel #4
0
        public async Task <bool> ProcessMessageAsync(ReceivedData data)
        {
            await Console.Out.WriteLineAsync(Encoding.UTF8.GetString(data.Data));

            return(data.AckMessage());
        }