Table of Contents

Interface IPublishObserver

Namespace
MassTransit
Assembly
MassTransit.Abstractions.dll

Observes messages as they are published via a publish endpoint. These should not be used to intercept or filter messages, in that case a filter should be created and registered on the transport.

public interface IPublishObserver

Methods

PostPublish<T>(PublishContext<T>)

Called after the message is sent to the transport (and confirmed by the transport if supported)

Task PostPublish<T>(PublishContext<T> context) where T : class

Parameters

context PublishContext<T>

The message send context

Returns

Task

Type Parameters

T

The message type

PrePublish<T>(PublishContext<T>)

Called before the message is sent to the transport

Task PrePublish<T>(PublishContext<T> context) where T : class

Parameters

context PublishContext<T>

The message send context

Returns

Task

Type Parameters

T

The message type

PublishFault<T>(PublishContext<T>, Exception)

Called when the message fails to send to the transport, including the exception that was thrown

Task PublishFault<T>(PublishContext<T> context, Exception exception) where T : class

Parameters

context PublishContext<T>

The message send context

exception Exception

The exception from the transport

Returns

Task

Type Parameters

T

The message type