Class MqttProducerEndpointConfigurationBuilder<TMessage>
Builds the MqttProducerEndpointConfiguration.
Inheritance
Implements
Inherited Members
Namespace: Silverback.Messaging.Configuration.Mqtt
Assembly: Silverback.Integration.MQTT.dll
Syntax
public class MqttProducerEndpointConfigurationBuilder<TMessage> : ProducerEndpointConfigurationBuilder<TMessage, MqttProducerEndpointConfiguration, MqttProducerEndpoint, MqttProducerEndpointConfigurationBuilder<TMessage>>, IMessageSerializationBuilder<TMessage, MqttProducerEndpointConfigurationBuilder<TMessage>> where TMessage : class
Type Parameters
| Name | Description |
|---|---|
| TMessage | The type of the messages being produced. |
Constructors
MqttProducerEndpointConfigurationBuilder(IServiceProvider, string?)
Initializes a new instance of the MqttProducerEndpointConfigurationBuilder<TMessage> class.
Declaration
public MqttProducerEndpointConfigurationBuilder(IServiceProvider serviceProvider, string? friendlyName = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IServiceProvider | serviceProvider | The IServiceProvider. |
| string | friendlyName | An optional friendly to be shown in the human-targeted output (e.g. logs, health checks result, etc.). |
Properties
This
Gets this instance.
Declaration
protected override MqttProducerEndpointConfigurationBuilder<TMessage> This { get; }
Property Value
| Type | Description |
|---|---|
| MqttProducerEndpointConfigurationBuilder<TMessage> |
Overrides
Remarks
This is necessary to work around casting in the base classes.
Methods
CreateConfiguration()
Creates the TConfiguration instance.
Declaration
protected override MqttProducerEndpointConfiguration CreateConfiguration()
Returns
| Type | Description |
|---|---|
| MqttProducerEndpointConfiguration | The endpoint. |
Overrides
IgnoreNoMatchingSubscribers()
Specifies that no exception should be thrown when no matching subscribers are found for the produced message.
Declaration
public MqttProducerEndpointConfigurationBuilder<TMessage> IgnoreNoMatchingSubscribers()
Returns
| Type | Description |
|---|---|
| MqttProducerEndpointConfigurationBuilder<TMessage> | The MqttProducerEndpointConfigurationBuilder<TMessage> so that additional calls can be chained. |
LogNoMatchingSubscribersWarning()
Specifies that a warning should be logged when no matching subscribers are found for the produced message.
Declaration
public MqttProducerEndpointConfigurationBuilder<TMessage> LogNoMatchingSubscribersWarning()
Returns
| Type | Description |
|---|---|
| MqttProducerEndpointConfigurationBuilder<TMessage> | The MqttProducerEndpointConfigurationBuilder<TMessage> so that additional calls can be chained. |
ProduceTo(Func<TMessage?, string>)
Specifies the functions returning the target topic for each message being produced.
Declaration
public MqttProducerEndpointConfigurationBuilder<TMessage> ProduceTo(Func<TMessage?, string> topicFunction)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<TMessage, string> | topicFunction | The function returning the target topic for the message being produced. |
Returns
| Type | Description |
|---|---|
| MqttProducerEndpointConfigurationBuilder<TMessage> | The MqttProducerEndpointConfigurationBuilder<TMessage> so that additional calls can be chained. |
ProduceTo(string)
Specifies the target topic and optionally the target partition.
Declaration
public MqttProducerEndpointConfigurationBuilder<TMessage> ProduceTo(string topic)
Parameters
| Type | Name | Description |
|---|---|---|
| string | topic | The target topic. |
Returns
| Type | Description |
|---|---|
| MqttProducerEndpointConfigurationBuilder<TMessage> | The MqttProducerEndpointConfigurationBuilder<TMessage> so that additional calls can be chained. |
ProduceTo(string, Func<TMessage?, string[]>)
Specifies the target topic format.
Declaration
public MqttProducerEndpointConfigurationBuilder<TMessage> ProduceTo(string topicFormatString, Func<TMessage?, string[]> topicArgumentsFunction)
Parameters
| Type | Name | Description |
|---|---|---|
| string | topicFormatString | The topic format string that will be combined with the arguments returned by the |
| Func<TMessage, string[]> | topicArgumentsFunction | The function returning the arguments to be used to format the string. |
Returns
| Type | Description |
|---|---|
| MqttProducerEndpointConfigurationBuilder<TMessage> | The MqttProducerEndpointConfigurationBuilder<TMessage> so that additional calls can be chained. |
ProduceToDynamicTopic()
Specifies that the target topic and, optionally, the target partition will be specified per each message using the envelope's SetMqttDestinationTopic(IOutboundEnvelope, string) extension method.
Declaration
public MqttProducerEndpointConfigurationBuilder<TMessage> ProduceToDynamicTopic()
Returns
| Type | Description |
|---|---|
| MqttProducerEndpointConfigurationBuilder<TMessage> | The MqttProducerEndpointConfigurationBuilder<TMessage> so that additional calls can be chained. |
Retain()
Specifies that the messages have to be sent with the retain flag, causing them to be persisted on the broker.
Declaration
public MqttProducerEndpointConfigurationBuilder<TMessage> Retain()
Returns
| Type | Description |
|---|---|
| MqttProducerEndpointConfigurationBuilder<TMessage> | The MqttProducerEndpointConfigurationBuilder<TMessage> so that additional calls can be chained. |
SetCorrelationData(byte[]?)
Sets the specified correlation data to all produced messages.
Declaration
public MqttProducerEndpointConfigurationBuilder<TMessage> SetCorrelationData(byte[]? correlationData)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | correlationData | The correlation data. |
Returns
| Type | Description |
|---|---|
| MqttProducerEndpointConfigurationBuilder<TMessage> | The endpoint builder so that additional calls can be chained. |
SetCorrelationData(Func<IOutboundEnvelope<TMessage>, byte[]?>)
Sets the correlation data to all produced messages, using a provider function to determine the correlation data for each message.
Declaration
public MqttProducerEndpointConfigurationBuilder<TMessage> SetCorrelationData(Func<IOutboundEnvelope<TMessage>, byte[]?> correlationDataProvider)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<IOutboundEnvelope<TMessage>, byte[]> | correlationDataProvider | The correlation data provider function. |
Returns
| Type | Description |
|---|---|
| MqttProducerEndpointConfigurationBuilder<TMessage> | The endpoint builder so that additional calls can be chained. |
SetCorrelationData(Func<IOutboundEnvelope<TMessage>, string?>)
Sets the correlation data to all produced messages, using a provider function to determine the correlation data for each message.
Declaration
public MqttProducerEndpointConfigurationBuilder<TMessage> SetCorrelationData(Func<IOutboundEnvelope<TMessage>, string?> correlationDataProvider)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<IOutboundEnvelope<TMessage>, string> | correlationDataProvider | The correlation data provider function. |
Returns
| Type | Description |
|---|---|
| MqttProducerEndpointConfigurationBuilder<TMessage> | The endpoint builder so that additional calls can be chained. |
SetCorrelationData(Func<TMessage?, byte[]?>)
Sets the correlation data to all produced messages, using a provider function to determine the correlation data for each message.
Declaration
public MqttProducerEndpointConfigurationBuilder<TMessage> SetCorrelationData(Func<TMessage?, byte[]?> correlationDataProvider)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<TMessage, byte[]> | correlationDataProvider | The correlation data provider function. |
Returns
| Type | Description |
|---|---|
| MqttProducerEndpointConfigurationBuilder<TMessage> | The endpoint builder so that additional calls can be chained. |
SetCorrelationData(Func<TMessage?, string?>)
Sets the correlation data to all produced messages, using a provider function to determine the correlation data for each message.
Declaration
public MqttProducerEndpointConfigurationBuilder<TMessage> SetCorrelationData(Func<TMessage?, string?> correlationDataProvider)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<TMessage, string> | correlationDataProvider | The correlation data provider function. |
Returns
| Type | Description |
|---|---|
| MqttProducerEndpointConfigurationBuilder<TMessage> | The endpoint builder so that additional calls can be chained. |
SetCorrelationData(string?)
Sets the specified correlation data to all produced messages.
Declaration
public MqttProducerEndpointConfigurationBuilder<TMessage> SetCorrelationData(string? correlationData)
Parameters
| Type | Name | Description |
|---|---|---|
| string | correlationData | The correlation data. |
Returns
| Type | Description |
|---|---|
| MqttProducerEndpointConfigurationBuilder<TMessage> | The endpoint builder so that additional calls can be chained. |
SetCorrelationData<TMessageChildType>(byte[]?)
Sets the specified correlation data to all produced messages of the specified child type.
Declaration
public MqttProducerEndpointConfigurationBuilder<TMessage> SetCorrelationData<TMessageChildType>(byte[]? correlationData) where TMessageChildType : TMessage
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | correlationData | The correlation data. |
Returns
| Type | Description |
|---|---|
| MqttProducerEndpointConfigurationBuilder<TMessage> | The endpoint builder so that additional calls can be chained. |
Type Parameters
| Name | Description |
|---|---|
| TMessageChildType | The type of the messages to be enriched with this header. |
SetCorrelationData<TMessageChildType>(Func<IOutboundEnvelope<TMessageChildType>, byte[]?>)
Sets the correlation data to all produced messages of the specified child type, using a provider function to determine the correlation data for each message.
Declaration
public MqttProducerEndpointConfigurationBuilder<TMessage> SetCorrelationData<TMessageChildType>(Func<IOutboundEnvelope<TMessageChildType>, byte[]?> correlationDataProvider) where TMessageChildType : TMessage
Parameters
| Type | Name | Description |
|---|---|---|
| Func<IOutboundEnvelope<TMessageChildType>, byte[]> | correlationDataProvider | The correlation data provider function. |
Returns
| Type | Description |
|---|---|
| MqttProducerEndpointConfigurationBuilder<TMessage> | The endpoint builder so that additional calls can be chained. |
Type Parameters
| Name | Description |
|---|---|
| TMessageChildType | The type of the messages to be enriched with this header. |
SetCorrelationData<TMessageChildType>(Func<IOutboundEnvelope<TMessageChildType>, string?>)
Sets the correlation data to all produced messages of the specified child type, using a provider function to determine the correlation data for each message.
Declaration
public MqttProducerEndpointConfigurationBuilder<TMessage> SetCorrelationData<TMessageChildType>(Func<IOutboundEnvelope<TMessageChildType>, string?> correlationDataProvider) where TMessageChildType : TMessage
Parameters
| Type | Name | Description |
|---|---|---|
| Func<IOutboundEnvelope<TMessageChildType>, string> | correlationDataProvider | The correlation data provider function. |
Returns
| Type | Description |
|---|---|
| MqttProducerEndpointConfigurationBuilder<TMessage> | The endpoint builder so that additional calls can be chained. |
Type Parameters
| Name | Description |
|---|---|
| TMessageChildType | The type of the messages to be enriched with this header. |
SetCorrelationData<TMessageChildType>(Func<TMessageChildType?, byte[]?>)
Sets the correlation data to all produced messages of the specified child type, using a provider function to determine the correlation data for each message.
Declaration
public MqttProducerEndpointConfigurationBuilder<TMessage> SetCorrelationData<TMessageChildType>(Func<TMessageChildType?, byte[]?> correlationDataProvider) where TMessageChildType : TMessage
Parameters
| Type | Name | Description |
|---|---|---|
| Func<TMessageChildType, byte[]> | correlationDataProvider | The correlation data provider function. |
Returns
| Type | Description |
|---|---|
| MqttProducerEndpointConfigurationBuilder<TMessage> | The endpoint builder so that additional calls can be chained. |
Type Parameters
| Name | Description |
|---|---|
| TMessageChildType | The type of the messages to be enriched with this header. |
SetCorrelationData<TMessageChildType>(Func<TMessageChildType?, string?>)
Sets the correlation data to all produced messages of the specified child type, using a provider function to determine the correlation data for each message.
Declaration
public MqttProducerEndpointConfigurationBuilder<TMessage> SetCorrelationData<TMessageChildType>(Func<TMessageChildType?, string?> correlationDataProvider) where TMessageChildType : TMessage
Parameters
| Type | Name | Description |
|---|---|---|
| Func<TMessageChildType, string> | correlationDataProvider | The correlation data provider function. |
Returns
| Type | Description |
|---|---|
| MqttProducerEndpointConfigurationBuilder<TMessage> | The endpoint builder so that additional calls can be chained. |
Type Parameters
| Name | Description |
|---|---|
| TMessageChildType | The type of the messages to be enriched with this header. |
SetCorrelationData<TMessageChildType>(string?)
Sets the specified correlation data to all produced messages of the specified child type.
Declaration
public MqttProducerEndpointConfigurationBuilder<TMessage> SetCorrelationData<TMessageChildType>(string? correlationData) where TMessageChildType : TMessage
Parameters
| Type | Name | Description |
|---|---|---|
| string | correlationData | The correlation data. |
Returns
| Type | Description |
|---|---|
| MqttProducerEndpointConfigurationBuilder<TMessage> | The endpoint builder so that additional calls can be chained. |
Type Parameters
| Name | Description |
|---|---|
| TMessageChildType | The type of the messages to be enriched with this header. |
SetResponseTopic(Func<IOutboundEnvelope<TMessage>, string?>)
Sets the response topic to all produced messages, using a provider function to determine the response topic for each message.
Declaration
public MqttProducerEndpointConfigurationBuilder<TMessage> SetResponseTopic(Func<IOutboundEnvelope<TMessage>, string?> responseTopicProvider)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<IOutboundEnvelope<TMessage>, string> | responseTopicProvider | The response topic provider function. |
Returns
| Type | Description |
|---|---|
| MqttProducerEndpointConfigurationBuilder<TMessage> | The endpoint builder so that additional calls can be chained. |
SetResponseTopic(Func<TMessage?, string?>)
Sets the response topic to all produced messages, using a provider function to determine the response topic for each message.
Declaration
public MqttProducerEndpointConfigurationBuilder<TMessage> SetResponseTopic(Func<TMessage?, string?> responseTopicProvider)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<TMessage, string> | responseTopicProvider | The response topic provider function. |
Returns
| Type | Description |
|---|---|
| MqttProducerEndpointConfigurationBuilder<TMessage> | The endpoint builder so that additional calls can be chained. |
SetResponseTopic(string?)
Sets the specified response topic to all produced messages.
Declaration
public MqttProducerEndpointConfigurationBuilder<TMessage> SetResponseTopic(string? responseTopic)
Parameters
| Type | Name | Description |
|---|---|---|
| string | responseTopic | The response topic. |
Returns
| Type | Description |
|---|---|
| MqttProducerEndpointConfigurationBuilder<TMessage> | The endpoint builder so that additional calls can be chained. |
SetResponseTopic<TMessageChildType>(Func<IOutboundEnvelope<TMessageChildType>, string?>)
Sets the response topic to all produced messages of the specified child type, using a provider function to determine the response topic for each message.
Declaration
public MqttProducerEndpointConfigurationBuilder<TMessage> SetResponseTopic<TMessageChildType>(Func<IOutboundEnvelope<TMessageChildType>, string?> responseTopicProvider) where TMessageChildType : TMessage
Parameters
| Type | Name | Description |
|---|---|---|
| Func<IOutboundEnvelope<TMessageChildType>, string> | responseTopicProvider | The response topic provider function. |
Returns
| Type | Description |
|---|---|
| MqttProducerEndpointConfigurationBuilder<TMessage> | The endpoint builder so that additional calls can be chained. |
Type Parameters
| Name | Description |
|---|---|
| TMessageChildType | The type of the messages to be enriched with this header. |
SetResponseTopic<TMessageChildType>(Func<TMessageChildType?, string?>)
Sets the response topic to all produced messages of the specified child type, using a provider function to determine the response topic for each message.
Declaration
public MqttProducerEndpointConfigurationBuilder<TMessage> SetResponseTopic<TMessageChildType>(Func<TMessageChildType?, string?> responseTopicProvider) where TMessageChildType : TMessage
Parameters
| Type | Name | Description |
|---|---|---|
| Func<TMessageChildType, string> | responseTopicProvider | The response topic provider function. |
Returns
| Type | Description |
|---|---|
| MqttProducerEndpointConfigurationBuilder<TMessage> | The endpoint builder so that additional calls can be chained. |
Type Parameters
| Name | Description |
|---|---|
| TMessageChildType | The type of the messages to be enriched with this header. |
SetResponseTopic<TMessageChildType>(string)
Sets the specified response topic to all produced messages of the specified child type.
Declaration
public MqttProducerEndpointConfigurationBuilder<TMessage> SetResponseTopic<TMessageChildType>(string responseTopic) where TMessageChildType : TMessage
Parameters
| Type | Name | Description |
|---|---|---|
| string | responseTopic | The response topic. |
Returns
| Type | Description |
|---|---|
| MqttProducerEndpointConfigurationBuilder<TMessage> | The endpoint builder so that additional calls can be chained. |
Type Parameters
| Name | Description |
|---|---|
| TMessageChildType | The type of the messages to be enriched with this header. |
ThrowNoMatchingSubscribersError()
Specifies that an exception should be thrown when no matching subscribers are found for the produced message.
Declaration
public MqttProducerEndpointConfigurationBuilder<TMessage> ThrowNoMatchingSubscribersError()
Returns
| Type | Description |
|---|---|
| MqttProducerEndpointConfigurationBuilder<TMessage> | The MqttProducerEndpointConfigurationBuilder<TMessage> so that additional calls can be chained. |
UseEndpointResolver<TResolver>()
Specifies the type of the IMqttProducerEndpointResolver<TMessage> to be used to resolve the target topic for each message being produced.
Declaration
public MqttProducerEndpointConfigurationBuilder<TMessage> UseEndpointResolver<TResolver>() where TResolver : IMqttProducerEndpointResolver<TMessage>
Returns
| Type | Description |
|---|---|
| MqttProducerEndpointConfigurationBuilder<TMessage> | The MqttProducerEndpointConfigurationBuilder<TMessage> so that additional calls can be chained. |
Type Parameters
| Name | Description |
|---|---|
| TResolver | The type of the IMqttProducerEndpointResolver<TMessage> to be used. |
WithAtLeastOnceQoS()
Specifies that the messages have to be sent with the at least once quality of service level.
Declaration
public MqttProducerEndpointConfigurationBuilder<TMessage> WithAtLeastOnceQoS()
Returns
| Type | Description |
|---|---|
| MqttProducerEndpointConfigurationBuilder<TMessage> | The MqttProducerEndpointConfigurationBuilder<TMessage> so that additional calls can be chained. |
WithAtMostOnceQoS()
Specifies that the messages have to be sent with the at most once quality of service level.
Declaration
public MqttProducerEndpointConfigurationBuilder<TMessage> WithAtMostOnceQoS()
Returns
| Type | Description |
|---|---|
| MqttProducerEndpointConfigurationBuilder<TMessage> | The MqttProducerEndpointConfigurationBuilder<TMessage> so that additional calls can be chained. |
WithExactlyOnceQoS()
Specifies that the messages have to be sent with the exactly once quality of service level.
Declaration
public MqttProducerEndpointConfigurationBuilder<TMessage> WithExactlyOnceQoS()
Returns
| Type | Description |
|---|---|
| MqttProducerEndpointConfigurationBuilder<TMessage> | The MqttProducerEndpointConfigurationBuilder<TMessage> so that additional calls can be chained. |
WithMessageExpiration(TimeSpan)
Sets the message expiry interval. This interval defines the period of time that the broker stores the PUBLISH message for any matching subscribers that are not currently connected. When no message expiry interval is set, the broker must store the message for matching subscribers indefinitely.
Declaration
public MqttProducerEndpointConfigurationBuilder<TMessage> WithMessageExpiration(TimeSpan messageExpiryInterval)
Parameters
| Type | Name | Description |
|---|---|---|
| TimeSpan | messageExpiryInterval | The TimeSpan representing the message expiry interval. |
Returns
| Type | Description |
|---|---|
| MqttProducerEndpointConfigurationBuilder<TMessage> | The MqttProducerEndpointConfigurationBuilder<TMessage> so that additional calls can be chained. |
WithQualityOfServiceLevel(MqttQualityOfServiceLevel)
Specifies the desired quality of service level.
Declaration
public MqttProducerEndpointConfigurationBuilder<TMessage> WithQualityOfServiceLevel(MqttQualityOfServiceLevel qosLevel)
Parameters
| Type | Name | Description |
|---|---|---|
| MqttQualityOfServiceLevel | qosLevel | The MQTTnet.Protocol.MqttQualityOfServiceLevel. |
Returns
| Type | Description |
|---|---|
| MqttProducerEndpointConfigurationBuilder<TMessage> | The MqttProducerEndpointConfigurationBuilder<TMessage> so that additional calls can be chained. |