public void LogProduced_Envelope_Logged()
        {
            var envelope = new OutboundEnvelope(
                null,
                new MessageHeaderCollection
            {
                { DefaultMessageHeaders.MessageType, "Message.Type" },
                { DefaultMessageHeaders.MessageId, "1234" },
                { KafkaMessageHeaders.KafkaMessageKey, "key1234" }
            },
                new KafkaProducerEndpoint("test1"),
                true,
                new KafkaOffset("topic2", 2, 42));

            var expectedMessage =
                "Message produced. | " +
                "endpointName: test1, " +
                "messageType: Message.Type, " +
                "messageId: 1234, " +
                "offset: [2]@42, " +
                "kafkaKey: key1234";

            _outboundLogger.LogProduced(envelope);

            _loggerSubstitute.Received(LogLevel.Information, null, expectedMessage, 1031);
        }
Example #2
0
        public void LogProduced_Envelope_Logged()
        {
            var envelope = new OutboundEnvelope(
                null,
                new MessageHeaderCollection
            {
                { DefaultMessageHeaders.MessageType, "Message.Type" },
                { DefaultMessageHeaders.MessageId, "1234" }
            },
                new TestProducerEndpoint("test1"),
                true,
                new TestOffset("a", "42"));

            var expectedMessage =
                "Message produced. | " +
                "endpointName: test1, " +
                "messageType: Message.Type, " +
                "messageId: 1234, " +
                "unused1: (null), " +
                "unused2: (null)";

            _outboundLogger.LogProduced(envelope);

            _loggerSubstitute.Received(LogLevel.Information, null, expectedMessage, 1031);
        }