Exemplo n.º 1
0
        private static void OnResultAtProducerReceived(ConsumeResult <string, string> cr, BaseSampleConsumer consumer)
        {
            var value = consumer.DecryptResult(cr); // File time UTC

            Console.WriteLine($"OnResultAtProducerReceived for {cr.Message.Key}. Created Time - {value}");
            // Let's print this value in console.
            // It should say how mutch time it took for processing the message.
            long time = long.Parse(value);

            DateTime createdTime = DateTime.FromFileTimeUtc(time);
            var      diff        = (DateTime.UtcNow - createdTime).TotalMilliseconds;

            Console.WriteLine($"Total time took for the message {cr.Message.Key} is {diff}");
        }
Exemplo n.º 2
0
        private static void OnResponseFromConsumerReceived(ConsumeResult <string, string> cr, BaseSampleConsumer consumer)
        {
            var producedTime = cr.Message.Timestamp.UtcDateTime.ToFileTimeUtc();

            // Create a sample response and send to the originator of the message.
            //Console.WriteLine($"Message received at OnResponseFromConsumerReceived. Created time for {cr.Message.Key} is {cr.Message.Timestamp.UtcDateTime.ToFileTimeUtc()}");

            responseProducer.ProduceMessage(cr.Message.Key, producedTime.ToString());
        }