Skip to content

IPublishEndpoint

Namespace: MassTransit

A publish endpoint lets the underlying transport determine the actual endpoint to which the message is sent. For example, an exchange on RabbitMQ and a topic on Azure Service bus.

public interface IPublishEndpoint : IPublishObserverConnector

Implements IPublishObserverConnector

Publishes a message to all subscribed consumers for the message type as specified by the generic parameter. The second parameter allows the caller to customize the outgoing publish context and set things like headers on the message.

Task Publish<T>(T message, CancellationToken cancellationToken)

T
The type of the message

message T
The messages to be published

cancellationToken CancellationToken

Task

Publish<T>(T, IPipe<PublishContext<T>>, CancellationToken)

Section titled “Publish<T>(T, IPipe<PublishContext<T>>, CancellationToken)”

Publishes a message to all subscribed consumers for the message type as specified by the generic parameter. The second parameter allows the caller to customize the outgoing publish context and set things like headers on the message.

Task Publish<T>(T message, IPipe<PublishContext<T>> publishPipe, CancellationToken cancellationToken)

T
The type of the message

message T
The messages to be published

publishPipe IPipe<PublishContext<T>>

cancellationToken CancellationToken

Task

Publish<T>(T, IPipe<PublishContext>, CancellationToken)

Section titled “Publish<T>(T, IPipe<PublishContext>, CancellationToken)”

Publishes a message to all subscribed consumers for the message type as specified by the generic parameter. The second parameter allows the caller to customize the outgoing publish context and set things like headers on the message.

Task Publish<T>(T message, IPipe<PublishContext> publishPipe, CancellationToken cancellationToken)

T
The type of the message

message T
The messages to be published

publishPipe IPipe<PublishContext>

cancellationToken CancellationToken

Task

Publishes an object as a message.

Task Publish(object message, CancellationToken cancellationToken)

message Object
The message object

cancellationToken CancellationToken

Task

Publish(Object, IPipe<PublishContext>, CancellationToken)

Section titled “Publish(Object, IPipe<PublishContext>, CancellationToken)”

Publishes an object as a message.

Task Publish(object message, IPipe<PublishContext> publishPipe, CancellationToken cancellationToken)

message Object
The message object

publishPipe IPipe<PublishContext>

cancellationToken CancellationToken

Task

Publishes an object as a message, using the message type specified. If the object cannot be cast to the specified message type, an exception will be thrown.

Task Publish(object message, Type messageType, CancellationToken cancellationToken)

message Object
The message object

messageType Type
The type of the message (use message.GetType() if desired)

cancellationToken CancellationToken

Task

Publish(Object, Type, IPipe<PublishContext>, CancellationToken)

Section titled “Publish(Object, Type, IPipe<PublishContext>, CancellationToken)”

Publishes an object as a message, using the message type specified. If the object cannot be cast to the specified message type, an exception will be thrown.

Task Publish(object message, Type messageType, IPipe<PublishContext> publishPipe, CancellationToken cancellationToken)

message Object
The message object

messageType Type
The type of the message (use message.GetType() if desired)

publishPipe IPipe<PublishContext>

cancellationToken CancellationToken

Task

IPublishEndpoint.Publish<T>(T, CancellationToken): this is a “dynamically” typed overload - give it an interface as its type parameter, and a loosely typed dictionary of values and the MassTransit underlying infrastructure will populate an object instance with the passed values. It actually does this with DynamicProxy in the background.

Task Publish<T>(object values, CancellationToken cancellationToken)

T
The type of the interface or non-sealed class with all-virtual members.

values Object
The dictionary of values to place in the object instance to implement the interface.

cancellationToken CancellationToken

Task

Publish<T>(Object, IPipe<PublishContext<T>>, CancellationToken)

Section titled “Publish<T>(Object, IPipe<PublishContext<T>>, CancellationToken)”

IPublishEndpoint.Publish<T>(T, CancellationToken): this overload further takes an action; it allows you to set PublishContext meta-data. Also IPublishEndpoint.Publish<T>(T, CancellationToken).

Task Publish<T>(object values, IPipe<PublishContext<T>> publishPipe, CancellationToken cancellationToken)

T
The type of the message to publish

values Object
The dictionary of values to become hydrated and published under the type of the interface.

publishPipe IPipe<PublishContext<T>>

cancellationToken CancellationToken

Task

Publish<T>(Object, IPipe<PublishContext>, CancellationToken)

Section titled “Publish<T>(Object, IPipe<PublishContext>, CancellationToken)”

IPublishEndpoint.Publish<T>(T, CancellationToken): this overload further takes an action; it allows you to set PublishContext meta-data. Also IPublishEndpoint.Publish<T>(T, CancellationToken).

Task Publish<T>(object values, IPipe<PublishContext> publishPipe, CancellationToken cancellationToken)

T
The type of the message to publish

values Object
The dictionary of values to become hydrated and published under the type of the interface.

publishPipe IPipe<PublishContext>

cancellationToken CancellationToken

Task