Interface IProducer
Produces to an endpoint.
Namespace: Silverback.Messaging.Broker
Assembly: Silverback.Integration.dll
Syntax
public interface IProducer
Properties
| Improve this doc View sourceBroker
Gets the IBroker instance that owns this .
Declaration
IBroker Broker { get; }
Property Value
Type | Description |
---|---|
IBroker |
Endpoint
Gets the IProducerEndpoint this instance is connected to.
Declaration
IProducerEndpoint Endpoint { get; }
Property Value
Type | Description |
---|---|
IProducerEndpoint |
Id
Gets the InstanceIdentifier uniquely identifying the producer instance.
Declaration
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
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
bool IsConnecting { get; }
Property Value
Type | Description |
---|---|
bool |
Methods
| Improve this doc View sourceConnectAsync()
Initializes the connection to the message broker (if needed).
Declaration
Task ConnectAsync()
Returns
Type | Description |
---|---|
Task | A Task representing the asynchronous operation. |
DisconnectAsync()
Disconnects from the message broker (if needed).
Declaration
Task DisconnectAsync()
Returns
Type | Description |
---|---|
Task | A Task representing the asynchronous operation. |
Produce(IOutboundEnvelope)
Publishes the specified message.
Declaration
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
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
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
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
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
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
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
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).
RawProduce(byte[]?, IReadOnlyCollection<MessageHeader>?)
Publishes the specified message as-is, without sending it through the behaviors pipeline.
Declaration
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
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
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
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
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
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
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
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
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
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 | 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).
RawProduceAsync(Stream?, IReadOnlyCollection<MessageHeader>?)
Publishes the specified message as-is, without sending it through the behaviors pipeline.
Declaration
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
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 | 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).
RawProduceAsync(string, byte[]?, IReadOnlyCollection<MessageHeader>?)
Publishes the specified message as-is, without sending it through the behaviors pipeline.
Declaration
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
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 | 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).
RawProduceAsync(string, Stream?, IReadOnlyCollection<MessageHeader>?)
Publishes the specified message as-is, without sending it through the behaviors pipeline.
Declaration
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
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 | 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).