Skip to main content
Table of Contents

Class LoggerMessagingExtensions

Namespace
Stratara.Shared.Diagnostics.Extensions
Assembly
Stratara.Outbox.RabbitMQ.dll

Source-generated ILogger extension methods for the Stratara messaging stack (RabbitMQ / Azure Service Bus dispatch and consumption). Event-IDs are defined in LogEvents.Messaging.

public static class LoggerMessagingExtensions
Inheritance
LoggerMessagingExtensions
Inherited Members

Methods

LogCommandEnvelopeDispatchFailed(ILogger, string, Exception)

Logs that a direct publish of a CommandEnvelope failed. The dispatcher will fall back to storing the envelope in the outbox table and rely on Stratara.Outbox.RabbitMQ.Outbox.OutboxWorker to retry the publish.

[LoggerMessage(EventId = 108103, Level = LogLevel.Warning, Message = "Error publishing command to topic {Topic}. Will store in outbox.")]
public static void LogCommandEnvelopeDispatchFailed(this ILogger logger, string topic, Exception exception)

Parameters

logger ILogger

The logger.

topic string

The command topic that failed.

exception Exception

The exception raised by the message-bus client.

LogCommittedEventsNotPublished(ILogger, string, Exception)

Logs that a handler committed its events but could not publish them, so the message is acknowledged instead of delivered again: running it twice would record the events twice.

[LoggerMessage(EventId = 108113, Level = LogLevel.Error, Message = "A message from topic {Topic} committed its events but could not publish them; it is acknowledged so it is not run twice. Replay the projections that consume those events.")]
public static void LogCommittedEventsNotPublished(this ILogger logger, string topic, Exception exception)

Parameters

logger ILogger

The logger.

topic string

The topic the message came from.

exception Exception

The save's failure, naming the committed streams.

LogConcurrencyConflictRequeued(ILogger, Guid, string)

Logs that a write-side concurrency conflict was detected while applying a command; the message has been NACKed with requeue=true for a retry against the new aggregate version.

[LoggerMessage(EventId = 108105, Level = LogLevel.Information, Message = "Concurrency conflict on stream {StreamId} ({AggregateTypeName}); message requeued for retry.")]
public static void LogConcurrencyConflictRequeued(this ILogger logger, Guid streamId, string aggregateTypeName)

Parameters

logger ILogger

The logger.

streamId Guid

The aggregate stream that conflicted.

aggregateTypeName string

CLR type name of the aggregate.

LogEventBundleDispatchFailed(ILogger, string, Exception)

Logs that a direct publish of an EventBundle failed. The dispatcher will fall back to storing the bundle in the outbox table and rely on Stratara.Outbox.RabbitMQ.Outbox.OutboxWorker to retry the publish.

[LoggerMessage(EventId = 108104, Level = LogLevel.Warning, Message = "Error publishing event bundle to topic {Topic}. Will store in outbox.")]
public static void LogEventBundleDispatchFailed(this ILogger logger, string topic, Exception exception)

Parameters

logger ILogger

The logger.

topic string

The event-bundle topic that failed.

exception Exception

The exception raised by the message-bus client.

LogMessageDeadLettered(ILogger, string, string, string, int)

Logs that a message exhausted its redelivery bound and was moved to the subscription's dead-letter destination.

[LoggerMessage(EventId = 108110, Level = LogLevel.Warning, Message = "Message on topic {Topic} dead-lettered for subscription {Subscription} after {DeliveryAttempt} deliveries ({Reason}).")]
public static void LogMessageDeadLettered(this ILogger logger, string topic, string subscription, string reason, int deliveryAttempt)

Parameters

logger ILogger

The logger.

topic string

The topic the message was published to.

subscription string

The subscription that could not take it.

reason string

conflict or failure.

deliveryAttempt int

How many times the message was delivered, counting the last.

LogMessageDeserializationFailed(ILogger, string, Exception)

Logs that a message body could not be deserialized into the expected payload type.

[LoggerMessage(EventId = 108102, Level = LogLevel.Error, Message = "Error deserialize message from topic {Topic}")]
public static void LogMessageDeserializationFailed(this ILogger logger, string topic, Exception exception)

Parameters

logger ILogger

The logger.

topic string

The topic / queue / exchange the message originated from.

exception Exception

The deserialization exception.

LogMessageNotSettledChannelClosed(ILogger, string, string, Exception)

Logs that a RabbitMQ delivery could not be settled because its channel had closed — the connection or the broker went away while the handler ran. The broker hands the message back and delivers it again, whether or not the handler completed.

[LoggerMessage(EventId = 108008, Level = LogLevel.Information, Message = "A message on {Topic} for {Subscription} could not be settled because its channel had closed; the broker delivers it again.")]
public static void LogMessageNotSettledChannelClosed(this ILogger logger, string topic, string subscription, Exception exception)

Parameters

logger ILogger

The logger.

topic string

The topic the message was published to.

subscription string

Identifier of the subscription that received it.

exception Exception

The exception the settlement or the handler raised on the closed channel.

LogMessageProcessingFailed(ILogger, string, Exception)

Logs that a message could not be processed by a subscription handler.

[LoggerMessage(EventId = 108101, Level = LogLevel.Error, Message = "Error processing message from topic {Topic}")]
public static void LogMessageProcessingFailed(this ILogger logger, string topic, Exception exception)

Parameters

logger ILogger

The logger.

topic string

The topic / queue / exchange the message originated from.

exception Exception

The exception raised by the handler or by the deserializer.

LogPublishChannelCleanupFailed(ILogger, Exception)

Logs that disposing the publish channel / connection before a recreate failed; the recreate proceeds anyway.

[LoggerMessage(EventId = 108109, Level = LogLevel.Warning, Message = "Error disposing RabbitMQ publish channel / connection before re-create; continuing.")]
public static void LogPublishChannelCleanupFailed(this ILogger logger, Exception exception)

Parameters

logger ILogger

The logger.

exception Exception

The cleanup exception.

LogRabbitMqGuestFallback(ILogger, string)

Warns that the bus is falling back to the default RabbitMQ guest/guest credentials.

[LoggerMessage(EventId = 108108, Level = LogLevel.Warning, Message = "RABBITMQ_USERNAME / RABBITMQ_PASSWORD not set — falling back to default guest credentials for host {Host}. Production hosts must set both.")]
public static void LogRabbitMqGuestFallback(this ILogger logger, string host)

Parameters

logger ILogger

The logger.

host string

The configured RabbitMQ host.

LogSubscriptionAlreadyClosed(ILogger, string, Exception)

Logs that a stopping RabbitMQ subscription found its connection already closed — the broker went away first — so there was no consumer left to cancel.

[LoggerMessage(EventId = 108007, Level = LogLevel.Debug, Message = "RabbitMQ subscription {Subscription} had lost its connection when it stopped; there was no consumer left to cancel.")]
public static void LogSubscriptionAlreadyClosed(this ILogger logger, string subscription, Exception exception)

Parameters

logger ILogger

The logger.

subscription string

Identifier of the subscription being cleaned up.

exception Exception

The exception the cancel raised on the closed connection.

LogSubscriptionCleanup(ILogger, string)

Logs that the RabbitMQ subscription is shutting down (cancellation requested).

[LoggerMessage(EventId = 108006, Level = LogLevel.Information, Message = "Cleaning up RabbitMQ subscription {Subscription}.")]
public static void LogSubscriptionCleanup(this ILogger logger, string subscription)

Parameters

logger ILogger

The logger.

subscription string

Identifier of the subscription being cleaned up.

LogSubscriptionCleanupFailed(ILogger, string, Exception)

Logs that the RabbitMQ subscription cleanup did not succeed cleanly.

[LoggerMessage(EventId = 108107, Level = LogLevel.Warning, Message = "Error during RabbitMQ subscription cleanup for {Subscription}.")]
public static void LogSubscriptionCleanupFailed(this ILogger logger, string subscription, Exception exception)

Parameters

logger ILogger

The logger.

subscription string

Identifier of the subscription being cleaned up.

exception Exception

The cleanup exception.

LogUnconsumedSubscription(ILogger, string, string, long)

Logs that a subscription being established holds a backlog and has no consumer attached: it keeps what is published to it until something consumes it, so a subscription whose worker is not deployed grows without end.

[LoggerMessage(EventId = 108114, Level = LogLevel.Warning, Message = "Subscription {Subscription}, established for topic {Topic}, holds {MessageCount} messages and no consumer is attached. An established subscription keeps what is published to it until something consumes it; if its worker is retired, stop establishing the subscription and delete it.")]
public static void LogUnconsumedSubscription(this ILogger logger, string subscription, string topic, long messageCount)

Parameters

logger ILogger

The logger.

subscription string

The subscription.

topic string

The topic the subscription is bound to.

messageCount long

How many messages the subscription holds.

LogWorkerQueueDeclaredWithOtherArguments(ILogger, string, string, int, string)

Warns that a worker queue already exists with arguments other than the ones declared now — typically the delivery limit of an earlier deployment's retry bounds — and is used as it is.

[LoggerMessage(EventId = 108112, Level = LogLevel.Warning, Message = "Worker queue {Queue} of subscription {Subscription} already exists with other arguments than the current retry bounds declare (x-delivery-limit {DeliveryLimit}) and is used as it is. Broker reply: {BrokerReply}")]
public static void LogWorkerQueueDeclaredWithOtherArguments(this ILogger logger, string subscription, string queue, int deliveryLimit, string brokerReply)

Parameters

logger ILogger

The logger.

subscription string

The subscription the queue belongs to.

queue string

The worker queue.

deliveryLimit int

The delivery limit the configured bounds would have declared.

brokerReply string

The broker's refusal, which names the argument and both values.