Table of Contents

Class StreamingMediator

Namespace
Mediarion
Assembly
Mediarion.Streaming.dll

A mediator that can stream as well as send and publish.

[RequiresUnreferencedCode("The mediator closes handler and behaviour generics over the request type at run time.")]
[RequiresDynamicCode("The mediator closes handler and behaviour generics over the request type at run time.")]
public class StreamingMediator : Mediator, IMediator, ISender, IPublisher, IStreamSender
Inheritance
StreamingMediator
Implements
Inherited Members
Extension Methods

Remarks

It derives from Mediator rather than replacing it, so registering this package changes what ISender resolves to and nothing else: sending and publishing behave exactly as they did.

A streaming request arrives as an IStreamRequest<TResponse>, so the response type is known and the request type is not, and the handler is generic over the request type. Closing that needs the run-time type, which is why this is marked as needing dynamic code — and why the generator writes the same dispatch as a switch for applications published ahead of time.

Constructors

StreamingMediator(IServiceProvider)

Creates a mediator that resolves its handlers from the given provider.

StreamingMediator(IServiceProvider, INotificationPublisher)

Creates a mediator with a publishing strategy of its own.

Methods

CreateStream(object, CancellationToken)

Sends a streaming request whose type is only known at run time.

CreateStream<TResponse>(IStreamRequest<TResponse>, CancellationToken)

Sends a streaming request.