Class Producer
Produces to an endpoint.
Implements
Inherited Members
Namespace: Silverback.Messaging.Broker
Assembly: Silverback.Integration.dll
Syntax
public abstract class Producer : IProducer
Constructors
| Improve this doc View sourceProducer(IBroker, IProducerEndpoint, IBrokerBehaviorsProvider<IProducerBehavior>, IServiceProvider, IOutboundLogger<Producer>)
Initializes a new instance of the Producer class.
Declaration
protected Producer(IBroker broker, IProducerEndpoint endpoint, IBrokerBehaviorsProvider<IProducerBehavior> behaviorsProvider, IServiceProvider serviceProvider, IOutboundLogger<Producer> logger)
Parameters
| Type | Name | Description |
|---|---|---|
| IBroker | broker | The IBroker that instantiated this producer. |
| IProducerEndpoint | endpoint | The endpoint to produce to. |
| IBrokerBehaviorsProvider<IProducerBehavior> | behaviorsProvider | |
| IServiceProvider | serviceProvider | The IServiceProvider to be used to resolve the needed services. |
| IOutboundLogger<Producer> | logger |
Properties
| Improve this doc View sourceBroker
Gets the IBroker instance that owns this .
Declaration
public IBroker Broker { get; }
Property Value
| Type | Description |
|---|---|
| IBroker |
Endpoint
Gets the IProducerEndpoint this instance is connected to.
Declaration
public IProducerEndpoint Endpoint { get; }
Property Value
| Type | Description |
|---|---|
| IProducerEndpoint |
Id
Gets the InstanceIdentifier uniquely identifying the producer instance.
Declaration
public InstanceIdentifier Id { get; }
Property Value
| Type | Description |
|---|---|
| InstanceIdentifier |
IsConnected
Gets a value indicating whether this producer is connected to the message broker and ready to produce messages.
Declaration
public bool IsConnected { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsConnecting
Gets a value indicating whether this producer is trying to connect to the message broker.
Declaration
public bool IsConnecting { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
| Improve this doc View sourceConnectAsync()
Initializes the connection to the message broker (if needed).
Declaration
public Task ConnectAsync()
Returns
| Type | Description |
|---|---|
| Task | A Task representing the asynchronous operation. |
ConnectCoreAsync()
Connects to the message broker.
Declaration
protected virtual Task ConnectCoreAsync()
Returns
| Type | Description |
|---|---|
| Task | A Task representing the asynchronous operation. |
DisconnectAsync()
Disconnects from the message broker (if needed).
Declaration
public Task DisconnectAsync()
Returns
| Type | Description |
|---|---|
| Task | A Task representing the asynchronous operation. |
DisconnectCoreAsync()
Disconnects from the message broker.
Declaration
protected virtual Task DisconnectCoreAsync()
Returns
| Type | Description |
|---|---|
| Task | A Task representing the asynchronous operation. |
Produce(IOutboundEnvelope)
Publishes the specified message.
Declaration
public IBrokerMessageIdentifier? Produce(IOutboundEnvelope envelope)
Parameters
| Type | Name | Description |
|---|---|---|
| IOutboundEnvelope | envelope | The envelope containing the message to be delivered. |
Returns
| Type | Description |
|---|---|
| IBrokerMessageIdentifier | The IBrokerMessageIdentifier of the produced record. |
Produce(IOutboundEnvelope, Action<IBrokerMessageIdentifier?>, Action<Exception>)
Publishes the specified message.
Declaration
public void Produce(IOutboundEnvelope envelope, Action<IBrokerMessageIdentifier?> onSuccess, Action<Exception> onError)
Parameters
| Type | Name | Description |
|---|---|---|
| IOutboundEnvelope | envelope | The envelope containing the message to be delivered. |
| Action<IBrokerMessageIdentifier> | onSuccess | The callback to be invoked when the message is successfully produced. |
| Action<Exception> | onError | The callback to be invoked when the produce fails. |
Remarks
In this implementation the message is synchronously enqueued but produced asynchronously. The callbacks are called when the message is actually produced (or the produce failed).
Produce(object?, IReadOnlyCollection<MessageHeader>?)
Publishes the specified message.
Declaration
public IBrokerMessageIdentifier? Produce(object? message, IReadOnlyCollection<MessageHeader>? headers = null)
Parameters
| Type | Name | Description |
|---|---|---|
| object | message | The message to be delivered. |
| IReadOnlyCollection<MessageHeader> | headers | The optional message headers. |
Returns
| Type | Description |
|---|---|
| IBrokerMessageIdentifier | The IBrokerMessageIdentifier of the produced record. |
Produce(object?, IReadOnlyCollection<MessageHeader>?, Action<IBrokerMessageIdentifier?>, Action<Exception>)
Publishes the specified message.
Declaration
public void Produce(object? message, IReadOnlyCollection<MessageHeader>? headers, Action<IBrokerMessageIdentifier?> onSuccess, Action<Exception> onError)
Parameters
| Type | Name | Description |
|---|---|---|
| object | message | The message to be delivered. |
| IReadOnlyCollection<MessageHeader> | headers | The optional message headers. |
| Action<IBrokerMessageIdentifier> | onSuccess | The callback to be invoked when the message is successfully produced. |
| Action<Exception> | onError | The callback to be invoked when the produce fails. |
Remarks
In this implementation the message is synchronously enqueued but produced asynchronously. The callbacks are called when the message is actually produced (or the produce failed).
ProduceAsync(IOutboundEnvelope)
Publishes the specified message.
Declaration
public Task<IBrokerMessageIdentifier?> ProduceAsync(IOutboundEnvelope envelope)
Parameters
| Type | Name | Description |
|---|---|---|
| IOutboundEnvelope | envelope | The envelope containing the message to be delivered. |
Returns
| Type | Description |
|---|---|
| Task<IBrokerMessageIdentifier> | A Task<TResult> representing the asynchronous operation. The task result contains the IBrokerMessageIdentifier of the produced record. |
ProduceAsync(IOutboundEnvelope, Action<IBrokerMessageIdentifier?>, Action<Exception>)
Publishes the specified message.
Declaration
public Task ProduceAsync(IOutboundEnvelope envelope, Action<IBrokerMessageIdentifier?> onSuccess, Action<Exception> onError)
Parameters
| Type | Name | Description |
|---|---|---|
| IOutboundEnvelope | envelope | The envelope containing the message to be delivered. |
| Action<IBrokerMessageIdentifier> | onSuccess | The callback to be invoked when the message is successfully produced. |
| Action<Exception> | onError | The callback to be invoked when the produce fails. |
Returns
| Type | Description |
|---|---|
| Task | A Task representing the asynchronous operation. The Task will complete as soon as the message is enqueued. |
Remarks
The returned Task completes when the message is enqueued while the callbacks are called when the message is actually produced (or the produce failed).
ProduceAsync(object?, IReadOnlyCollection<MessageHeader>?)
Publishes the specified message.
Declaration
public Task<IBrokerMessageIdentifier?> ProduceAsync(object? message, IReadOnlyCollection<MessageHeader>? headers = null)
Parameters
| Type | Name | Description |
|---|---|---|
| object | message | The message to be delivered. |
| IReadOnlyCollection<MessageHeader> | headers | The optional message headers. |
Returns
| Type | Description |
|---|---|
| Task<IBrokerMessageIdentifier> | A Task<TResult> representing the asynchronous operation. The task result contains the IBrokerMessageIdentifier of the produced record. |
ProduceAsync(object?, IReadOnlyCollection<MessageHeader>?, Action<IBrokerMessageIdentifier?>, Action<Exception>)
Publishes the specified message.
Declaration
public Task ProduceAsync(object? message, IReadOnlyCollection<MessageHeader>? headers, Action<IBrokerMessageIdentifier?> onSuccess, Action<Exception> onError)
Parameters
| Type | Name | Description |
|---|---|---|
| object | message | The message to be delivered. |
| IReadOnlyCollection<MessageHeader> | headers | The optional message headers. |
| Action<IBrokerMessageIdentifier> | onSuccess | The callback to be invoked when the message is successfully produced. |
| Action<Exception> | onError | The callback to be invoked when the produce fails. |
Returns
| Type | Description |
|---|---|
| Task | A Task representing the asynchronous operation. The Task will complete as soon as the message is enqueued. |
Remarks
The returned Task completes when the message is enqueued while the callbacks are called when the message is actually produced (or the produce failed).
ProduceCore(object?, byte[]?, IReadOnlyCollection<MessageHeader>?, string)
Publishes the specified message and returns its identifier.
Declaration
protected abstract IBrokerMessageIdentifier? ProduceCore(object? message, byte[]? messageBytes, IReadOnlyCollection<MessageHeader>? headers, string actualEndpointName)
Parameters
| Type | Name | Description |
|---|---|---|
| object | message | The message to be delivered before serialization. This might be null if RawProduce(byte[]?, IReadOnlyCollection<MessageHeader>?), RawProduce(Stream?, IReadOnlyCollection<MessageHeader>?), RawProduceAsync(byte[]?, IReadOnlyCollection<MessageHeader>?) or RawProduceAsync(Stream?, IReadOnlyCollection<MessageHeader>?) have been used to produce. |
| byte[] | messageBytes | The actual serialized message to be delivered. |
| IReadOnlyCollection<MessageHeader> | headers | The message headers. |
| string | actualEndpointName | The actual endpoint to produce to. |
Returns
| Type | Description |
|---|---|
| IBrokerMessageIdentifier | The message identifier assigned by the broker (the Kafka offset or similar). |
ProduceCore(object?, byte[]?, IReadOnlyCollection<MessageHeader>?, string, Action<IBrokerMessageIdentifier?>, Action<Exception>)
Publishes the specified message and returns its identifier.
Declaration
protected abstract void ProduceCore(object? message, byte[]? messageBytes, IReadOnlyCollection<MessageHeader>? headers, string actualEndpointName, Action<IBrokerMessageIdentifier?> onSuccess, Action<Exception> onError)
Parameters
| Type | Name | Description |
|---|---|---|
| object | message | The message to be delivered before serialization. This might be null if RawProduce(byte[]?, IReadOnlyCollection<MessageHeader>?), RawProduce(Stream?, IReadOnlyCollection<MessageHeader>?), RawProduceAsync(byte[]?, IReadOnlyCollection<MessageHeader>?) or RawProduceAsync(Stream?, IReadOnlyCollection<MessageHeader>?) have been used to produce. |
| byte[] | messageBytes | The actual serialized message to be delivered. |
| IReadOnlyCollection<MessageHeader> | headers | The message headers. |
| string | actualEndpointName | The actual endpoint to produce to. |
| Action<IBrokerMessageIdentifier> | onSuccess | The callback to be invoked when the message is successfully produced. |
| Action<Exception> | onError | The callback to be invoked when the produce fails. |
Remarks
In this implementation the message is synchronously enqueued but produced asynchronously. The callbacks are called when the message is actually produced (or the produce failed).
ProduceCore(object?, Stream?, IReadOnlyCollection<MessageHeader>?, string)
Publishes the specified message and returns its identifier.
Declaration
protected abstract IBrokerMessageIdentifier? ProduceCore(object? message, Stream? messageStream, IReadOnlyCollection<MessageHeader>? headers, string actualEndpointName)
Parameters
| Type | Name | Description |
|---|---|---|
| object | message | The message to be delivered before serialization. This might be null if RawProduce(byte[]?, IReadOnlyCollection<MessageHeader>?), RawProduce(Stream?, IReadOnlyCollection<MessageHeader>?), RawProduceAsync(byte[]?, IReadOnlyCollection<MessageHeader>?) or RawProduceAsync(Stream?, IReadOnlyCollection<MessageHeader>?) have been used to produce. |
| Stream | messageStream | The actual serialized message to be delivered. |
| IReadOnlyCollection<MessageHeader> | headers | The message headers. |
| string | actualEndpointName | The actual endpoint to produce to. |
Returns
| Type | Description |
|---|---|
| IBrokerMessageIdentifier | The message identifier assigned by the broker (the Kafka offset or similar). |
ProduceCore(object?, Stream?, IReadOnlyCollection<MessageHeader>?, string, Action<IBrokerMessageIdentifier?>, Action<Exception>)
Publishes the specified message and returns its identifier.
Declaration
protected abstract void ProduceCore(object? message, Stream? messageStream, IReadOnlyCollection<MessageHeader>? headers, string actualEndpointName, Action<IBrokerMessageIdentifier?> onSuccess, Action<Exception> onError)
Parameters
| Type | Name | Description |
|---|---|---|
| object | message | The message to be delivered before serialization. This might be null if RawProduce(byte[]?, IReadOnlyCollection<MessageHeader>?), RawProduce(Stream?, IReadOnlyCollection<MessageHeader>?), RawProduceAsync(byte[]?, IReadOnlyCollection<MessageHeader>?) or RawProduceAsync(Stream?, IReadOnlyCollection<MessageHeader>?) have been used to produce. |
| Stream | messageStream | The message to be delivered. |
| IReadOnlyCollection<MessageHeader> | headers | The message headers. |
| string | actualEndpointName | The actual endpoint to produce to. |
| Action<IBrokerMessageIdentifier> | onSuccess | The callback to be invoked when the message is successfully produced. |
| Action<Exception> | onError | The callback to be invoked when the produce fails. |
Remarks
In this implementation the message is synchronously enqueued but produced asynchronously. The callbacks are called when the message is actually produced (or the produce failed).
ProduceCoreAsync(object?, byte[]?, IReadOnlyCollection<MessageHeader>?, string)
Publishes the specified message and returns its identifier.
Declaration
protected abstract Task<IBrokerMessageIdentifier?> ProduceCoreAsync(object? message, byte[]? messageBytes, IReadOnlyCollection<MessageHeader>? headers, string actualEndpointName)
Parameters
| Type | Name | Description |
|---|---|---|
| object | message | The message to be delivered before serialization. This might be null if RawProduce(byte[]?, IReadOnlyCollection<MessageHeader>?), RawProduce(Stream?, IReadOnlyCollection<MessageHeader>?), RawProduceAsync(byte[]?, IReadOnlyCollection<MessageHeader>?) or RawProduceAsync(Stream?, IReadOnlyCollection<MessageHeader>?) have been used to produce. |
| byte[] | messageBytes | The actual serialized message to be delivered. |
| IReadOnlyCollection<MessageHeader> | headers | The message headers. |
| string | actualEndpointName | The actual endpoint to produce to. |
Returns
| Type | Description |
|---|---|
| Task<IBrokerMessageIdentifier> | A Task<TResult> representing the asynchronous operation. The task result contains the message identifier assigned by the broker (the Kafka offset or similar). |
ProduceCoreAsync(object?, byte[]?, IReadOnlyCollection<MessageHeader>?, string, Action<IBrokerMessageIdentifier?>, Action<Exception>)
Publishes the specified message and returns its identifier.
Declaration
protected abstract Task ProduceCoreAsync(object? message, byte[]? messageBytes, IReadOnlyCollection<MessageHeader>? headers, string actualEndpointName, Action<IBrokerMessageIdentifier?> onSuccess, Action<Exception> onError)
Parameters
| Type | Name | Description |
|---|---|---|
| object | message | The message to be delivered before serialization. This might be null if RawProduce(byte[]?, IReadOnlyCollection<MessageHeader>?), RawProduce(Stream?, IReadOnlyCollection<MessageHeader>?), RawProduceAsync(byte[]?, IReadOnlyCollection<MessageHeader>?) or RawProduceAsync(Stream?, IReadOnlyCollection<MessageHeader>?) have been used to produce. |
| byte[] | messageBytes | The actual serialized message to be delivered. |
| IReadOnlyCollection<MessageHeader> | headers | The message headers. |
| string | actualEndpointName | The actual endpoint to produce to. |
| Action<IBrokerMessageIdentifier> | onSuccess | The callback to be invoked when the message is successfully produced. |
| Action<Exception> | onError | The callback to be invoked when the produce fails. |
Returns
| Type | Description |
|---|---|
| Task | A Task representing the asynchronous operation. The Task will complete as soon as the message is enqueued. |
Remarks
The returned Task completes when the message is enqueued while the callbacks are called when the message is actually produced (or the produce failed).
ProduceCoreAsync(object?, Stream?, IReadOnlyCollection<MessageHeader>?, string)
Publishes the specified message and returns its identifier.
Declaration
protected abstract Task<IBrokerMessageIdentifier?> ProduceCoreAsync(object? message, Stream? messageStream, IReadOnlyCollection<MessageHeader>? headers, string actualEndpointName)
Parameters
| Type | Name | Description |
|---|---|---|
| object | message | The message to be delivered before serialization. This might be null if RawProduce(byte[]?, IReadOnlyCollection<MessageHeader>?), RawProduce(Stream?, IReadOnlyCollection<MessageHeader>?), RawProduceAsync(byte[]?, IReadOnlyCollection<MessageHeader>?) or RawProduceAsync(Stream?, IReadOnlyCollection<MessageHeader>?) have been used to produce. |
| Stream | messageStream | The message to be delivered. |
| IReadOnlyCollection<MessageHeader> | headers | The message headers. |
| string | actualEndpointName | The actual endpoint to produce to. |
Returns
| Type | Description |
|---|---|
| Task<IBrokerMessageIdentifier> | A Task<TResult> representing the asynchronous operation. The task result contains the message identifier assigned by the broker (the Kafka offset or similar). |
ProduceCoreAsync(object?, Stream?, IReadOnlyCollection<MessageHeader>?, string, Action<IBrokerMessageIdentifier?>, Action<Exception>)
Publishes the specified message and returns its identifier.
Declaration
protected abstract Task ProduceCoreAsync(object? message, Stream? messageStream, IReadOnlyCollection<MessageHeader>? headers, string actualEndpointName, Action<IBrokerMessageIdentifier?> onSuccess, Action<Exception> onError)
Parameters
| Type | Name | Description |
|---|---|---|
| object | message | The message to be delivered before serialization. This might be null if RawProduce(byte[]?, IReadOnlyCollection<MessageHeader>?), RawProduce(Stream?, IReadOnlyCollection<MessageHeader>?), RawProduceAsync(byte[]?, IReadOnlyCollection<MessageHeader>?) or RawProduceAsync(Stream?, IReadOnlyCollection<MessageHeader>?) have been used to produce. |
| Stream | messageStream | The message to be delivered. |
| IReadOnlyCollection<MessageHeader> | headers | The message headers. |
| string | actualEndpointName | The actual endpoint to produce to. |
| Action<IBrokerMessageIdentifier> | onSuccess | The callback to be invoked when the message is successfully produced. |
| Action<Exception> | onError | The callback to be invoked when the produce fails. |
Returns
| Type | Description |
|---|---|
| Task | A Task representing the asynchronous operation. The Task will complete as soon as the message is enqueued. |
Remarks
The returned Task completes when the message is enqueued while the callbacks are called when the message is actually produced (or the produce failed).
RawProduce(byte[]?, IReadOnlyCollection<MessageHeader>?)
Publishes the specified message as-is, without sending it through the behaviors pipeline.
Declaration
public IBrokerMessageIdentifier? RawProduce(byte[]? messageContent, IReadOnlyCollection<MessageHeader>? headers = null)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | messageContent | The message to be delivered. |
| IReadOnlyCollection<MessageHeader> | headers | The optional message headers. |
Returns
| Type | Description |
|---|---|
| IBrokerMessageIdentifier | The IBrokerMessageIdentifier of the produced record. |
RawProduce(byte[]?, IReadOnlyCollection<MessageHeader>?, Action<IBrokerMessageIdentifier?>, Action<Exception>)
Publishes the specified message as-is, without sending it through the behaviors pipeline.
Declaration
public void RawProduce(byte[]? messageContent, IReadOnlyCollection<MessageHeader>? headers, Action<IBrokerMessageIdentifier?> onSuccess, Action<Exception> onError)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | messageContent | The message to be delivered. |
| IReadOnlyCollection<MessageHeader> | headers | The optional message headers. |
| Action<IBrokerMessageIdentifier> | onSuccess | The callback to be invoked when the message is successfully produced. |
| Action<Exception> | onError | The callback to be invoked when the produce fails. |
Remarks
In this implementation the message is synchronously enqueued but produced asynchronously. The callbacks are called when the message is actually produced (or the produce failed).
RawProduce(Stream?, IReadOnlyCollection<MessageHeader>?)
Publishes the specified message as-is, without sending it through the behaviors pipeline.
Declaration
public IBrokerMessageIdentifier? RawProduce(Stream? messageStream, IReadOnlyCollection<MessageHeader>? headers = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | messageStream | The message to be delivered. |
| IReadOnlyCollection<MessageHeader> | headers | The optional message headers. |
Returns
| Type | Description |
|---|---|
| IBrokerMessageIdentifier | The IBrokerMessageIdentifier of the produced record. |
RawProduce(Stream?, IReadOnlyCollection<MessageHeader>?, Action<IBrokerMessageIdentifier?>, Action<Exception>)
Publishes the specified message as-is, without sending it through the behaviors pipeline.
Declaration
public void RawProduce(Stream? messageStream, IReadOnlyCollection<MessageHeader>? headers, Action<IBrokerMessageIdentifier?> onSuccess, Action<Exception> onError)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | messageStream | The message to be delivered. |
| IReadOnlyCollection<MessageHeader> | headers | The optional message headers. |
| Action<IBrokerMessageIdentifier> | onSuccess | The callback to be invoked when the message is successfully produced. |
| Action<Exception> | onError | The callback to be invoked when the produce fails. |
Remarks
In this implementation the message is synchronously enqueued but produced asynchronously. The callbacks are called when the message is actually produced (or the produce failed).
RawProduce(string, byte[]?, IReadOnlyCollection<MessageHeader>?)
Publishes the specified message as-is, without sending it through the behaviors pipeline.
Declaration
public IBrokerMessageIdentifier? RawProduce(string actualEndpointName, byte[]? messageContent, IReadOnlyCollection<MessageHeader>? headers = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | actualEndpointName | The actual target endpoint name. |
| byte[] | messageContent | The message to be delivered. |
| IReadOnlyCollection<MessageHeader> | headers | The optional message headers. |
Returns
| Type | Description |
|---|---|
| IBrokerMessageIdentifier | The IBrokerMessageIdentifier of the produced record. |
RawProduce(string, byte[]?, IReadOnlyCollection<MessageHeader>?, Action<IBrokerMessageIdentifier?>, Action<Exception>)
Publishes the specified message as-is, without sending it through the behaviors pipeline.
Declaration
public void RawProduce(string actualEndpointName, byte[]? messageContent, IReadOnlyCollection<MessageHeader>? headers, Action<IBrokerMessageIdentifier?> onSuccess, Action<Exception> onError)
Parameters
| Type | Name | Description |
|---|---|---|
| string | actualEndpointName | The actual target endpoint name. |
| byte[] | messageContent | The message to be delivered. |
| IReadOnlyCollection<MessageHeader> | headers | The optional message headers. |
| Action<IBrokerMessageIdentifier> | onSuccess | The callback to be invoked when the message is successfully produced. |
| Action<Exception> | onError | The callback to be invoked when the produce fails. |
Remarks
In this implementation the message is synchronously enqueued but produced asynchronously. The callbacks are called when the message is actually produced (or the produce failed).
RawProduce(string, Stream?, IReadOnlyCollection<MessageHeader>?)
Publishes the specified message as-is, without sending it through the behaviors pipeline.
Declaration
public IBrokerMessageIdentifier? RawProduce(string actualEndpointName, Stream? messageStream, IReadOnlyCollection<MessageHeader>? headers = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | actualEndpointName | The actual target endpoint name. |
| Stream | messageStream | The message to be delivered. |
| IReadOnlyCollection<MessageHeader> | headers | The optional message headers. |
Returns
| Type | Description |
|---|---|
| IBrokerMessageIdentifier | The IBrokerMessageIdentifier of the produced record. |
RawProduce(string, Stream?, IReadOnlyCollection<MessageHeader>?, Action<IBrokerMessageIdentifier?>, Action<Exception>)
Publishes the specified message as-is, without sending it through the behaviors pipeline.
Declaration
public void RawProduce(string actualEndpointName, Stream? messageStream, IReadOnlyCollection<MessageHeader>? headers, Action<IBrokerMessageIdentifier?> onSuccess, Action<Exception> onError)
Parameters
| Type | Name | Description |
|---|---|---|
| string | actualEndpointName | The actual target endpoint name. |
| Stream | messageStream | The message to be delivered. |
| IReadOnlyCollection<MessageHeader> | headers | The optional message headers. |
| Action<IBrokerMessageIdentifier> | onSuccess | The callback to be invoked when the message is successfully produced. |
| Action<Exception> | onError | The callback to be invoked when the produce fails. |
Remarks
In this implementation the message is synchronously enqueued but produced asynchronously. The callbacks are called when the message is actually produced (or the produce failed).
RawProduceAsync(byte[]?, IReadOnlyCollection<MessageHeader>?)
Publishes the specified message as-is, without sending it through the behaviors pipeline.
Declaration
public Task<IBrokerMessageIdentifier?> RawProduceAsync(byte[]? messageContent, IReadOnlyCollection<MessageHeader>? headers = null)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | messageContent | The message to be delivered. |
| IReadOnlyCollection<MessageHeader> | headers | The optional message headers. |
Returns
| Type | Description |
|---|---|
| Task<IBrokerMessageIdentifier> | A Task<TResult> representing the asynchronous operation. The task result contains the IBrokerMessageIdentifier of the produced record. |
RawProduceAsync(byte[]?, IReadOnlyCollection<MessageHeader>?, Action<IBrokerMessageIdentifier?>, Action<Exception>)
Publishes the specified message as-is, without sending it through the behaviors pipeline.
Declaration
public Task RawProduceAsync(byte[]? messageContent, IReadOnlyCollection<MessageHeader>? headers, Action<IBrokerMessageIdentifier?> onSuccess, Action<Exception> onError)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | messageContent | The message to be delivered. |
| IReadOnlyCollection<MessageHeader> | headers | The optional message headers. |
| Action<IBrokerMessageIdentifier> | onSuccess | |
| Action<Exception> | onError |
Returns
| Type | Description |
|---|---|
| Task | A Task<TResult> representing the asynchronous operation. The task result contains the IBrokerMessageIdentifier of the produced record. |
RawProduceAsync(Stream?, IReadOnlyCollection<MessageHeader>?)
Publishes the specified message as-is, without sending it through the behaviors pipeline.
Declaration
public Task<IBrokerMessageIdentifier?> RawProduceAsync(Stream? messageStream, IReadOnlyCollection<MessageHeader>? headers = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | messageStream | The message to be delivered. |
| IReadOnlyCollection<MessageHeader> | headers | The optional message headers. |
Returns
| Type | Description |
|---|---|
| Task<IBrokerMessageIdentifier> | A Task<TResult> representing the asynchronous operation. The task result contains the IBrokerMessageIdentifier of the produced record. |
RawProduceAsync(Stream?, IReadOnlyCollection<MessageHeader>?, Action<IBrokerMessageIdentifier?>, Action<Exception>)
Publishes the specified message as-is, without sending it through the behaviors pipeline.
Declaration
public Task RawProduceAsync(Stream? messageStream, IReadOnlyCollection<MessageHeader>? headers, Action<IBrokerMessageIdentifier?> onSuccess, Action<Exception> onError)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | messageStream | The message to be delivered. |
| IReadOnlyCollection<MessageHeader> | headers | The optional message headers. |
| Action<IBrokerMessageIdentifier> | onSuccess | |
| Action<Exception> | onError |
Returns
| Type | Description |
|---|---|
| Task | A Task<TResult> representing the asynchronous operation. The task result contains the IBrokerMessageIdentifier of the produced record. |
RawProduceAsync(string, byte[]?, IReadOnlyCollection<MessageHeader>?)
Publishes the specified message as-is, without sending it through the behaviors pipeline.
Declaration
public Task<IBrokerMessageIdentifier?> RawProduceAsync(string actualEndpointName, byte[]? messageContent, IReadOnlyCollection<MessageHeader>? headers = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | actualEndpointName | The actual target endpoint name. |
| byte[] | messageContent | The message to be delivered. |
| IReadOnlyCollection<MessageHeader> | headers | The optional message headers. |
Returns
| Type | Description |
|---|---|
| Task<IBrokerMessageIdentifier> | A Task<TResult> representing the asynchronous operation. The task result contains the IBrokerMessageIdentifier of the produced record. |
RawProduceAsync(string, byte[]?, IReadOnlyCollection<MessageHeader>?, Action<IBrokerMessageIdentifier?>, Action<Exception>)
Publishes the specified message as-is, without sending it through the behaviors pipeline.
Declaration
public Task RawProduceAsync(string actualEndpointName, byte[]? messageContent, IReadOnlyCollection<MessageHeader>? headers, Action<IBrokerMessageIdentifier?> onSuccess, Action<Exception> onError)
Parameters
| Type | Name | Description |
|---|---|---|
| string | actualEndpointName | The actual target endpoint name. |
| byte[] | messageContent | The message to be delivered. |
| IReadOnlyCollection<MessageHeader> | headers | The optional message headers. |
| Action<IBrokerMessageIdentifier> | onSuccess | |
| Action<Exception> | onError |
Returns
| Type | Description |
|---|---|
| Task | A Task<TResult> representing the asynchronous operation. The task result contains the IBrokerMessageIdentifier of the produced record. |
RawProduceAsync(string, Stream?, IReadOnlyCollection<MessageHeader>?)
Publishes the specified message as-is, without sending it through the behaviors pipeline.
Declaration
public Task<IBrokerMessageIdentifier?> RawProduceAsync(string actualEndpointName, Stream? messageStream, IReadOnlyCollection<MessageHeader>? headers = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | actualEndpointName | The actual target endpoint name. |
| Stream | messageStream | The message to be delivered. |
| IReadOnlyCollection<MessageHeader> | headers | The optional message headers. |
Returns
| Type | Description |
|---|---|
| Task<IBrokerMessageIdentifier> | A Task<TResult> representing the asynchronous operation. The task result contains the IBrokerMessageIdentifier of the produced record. |
RawProduceAsync(string, Stream?, IReadOnlyCollection<MessageHeader>?, Action<IBrokerMessageIdentifier?>, Action<Exception>)
Publishes the specified message as-is, without sending it through the behaviors pipeline.
Declaration
public Task RawProduceAsync(string actualEndpointName, Stream? messageStream, IReadOnlyCollection<MessageHeader>? headers, Action<IBrokerMessageIdentifier?> onSuccess, Action<Exception> onError)
Parameters
| Type | Name | Description |
|---|---|---|
| string | actualEndpointName | The actual target endpoint name. |
| Stream | messageStream | The message to be delivered. |
| IReadOnlyCollection<MessageHeader> | headers | The optional message headers. |
| Action<IBrokerMessageIdentifier> | onSuccess | |
| Action<Exception> | onError |
Returns
| Type | Description |
|---|---|
| Task | A Task<TResult> representing the asynchronous operation. The task result contains the IBrokerMessageIdentifier of the produced record. |