public override Task Handle(EntityMessage <EchoEntity> message)
        {
            var loggerState = new Dictionary <string, object>
            {
                [LogPropertyKeys.CorrelationId] = message.CorrelationId,
            };

            using (this.Logger.BeginScope(loggerState))
            {
                this.Logger.LogInformation($"{{LogKey:l}} {message.Entity.Text} (name={{MessageName}}, id={{EventId}}, origin={{EventOrigin}})", LogKeys.AppMessaging, message.GetType().PrettyName(), message.Id, message.Origin);
                Thread.Sleep(RandomGenerator.GenerateInt(500, 3500));
                return(Task.CompletedTask);
            }
        }
Exemple #2
0
        /// <summary>
        /// Handles the specified message.
        /// </summary>
        /// <param name="message">The message.</param>
        public virtual Task Handle(EntityMessage <T> message)
        {
            var loggerState = new Dictionary <string, object>
            {
                [LogPropertyKeys.CorrelationId] = message.CorrelationId,
            };

            using (this.Logger.BeginScope(loggerState))
            {
                this.Logger.LogInformation("{LogKey:l} handle (name={MessageName}, id={MessageId}, origin={MessageOrigin}) " + message.Entity.GetType().Name, LogKeys.AppMessaging, message.GetType().PrettyName(), message.Id, message.Origin);
                Thread.Sleep(RandomGenerator.GenerateInt(500, 3500));
                return(Task.CompletedTask);
            }
        }