예제 #1
0
        public void LogWrittenToOutbox_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 =
                "Writing the outbound message to the transactional outbox. | " +
                "endpointName: test1, " +
                "messageType: Message.Type, " +
                "messageId: 1234, " +
                "offset: [2]@42, " +
                "kafkaKey: key1234";

            _outboundLogger.LogWrittenToOutbox(envelope);

            _loggerSubstitute.Received(LogLevel.Debug, null, expectedMessage, 1073);
        }
예제 #2
0
        public void LogWrittenToOutbox_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 =
                "Writing the outbound message to the transactional outbox. | " +
                "endpointName: test1, " +
                "messageType: Message.Type, " +
                "messageId: 1234, " +
                "unused1: (null), " +
                "unused2: (null)";

            _outboundLogger.LogWrittenToOutbox(envelope);

            _loggerSubstitute.Received(LogLevel.Debug, null, expectedMessage, 1073);
        }
            public Task ProduceAsync(IOutboundEnvelope envelope)
            {
                Check.NotNull(envelope, nameof(envelope));

                _logger.LogWrittenToOutbox(envelope);

                return(_outboundQueueBroker.GetProducer(envelope.Endpoint).ProduceAsync(envelope));
            }