Class MqttProducerEndpointBuilder
Builds the MqttProducerEndpoint.
Inheritance
Implements
Inherited Members
Namespace: Silverback.Messaging.Configuration.Mqtt
Assembly: Silverback.Integration.MQTT.dll
Syntax
public class MqttProducerEndpointBuilder : ProducerEndpointBuilder<MqttProducerEndpoint, IMqttProducerEndpointBuilder>, IMqttProducerEndpointBuilder, IProducerEndpointBuilder<IMqttProducerEndpointBuilder>, IEndpointBuilder<IMqttProducerEndpointBuilder>
Constructors
| Improve this doc View sourceMqttProducerEndpointBuilder(MqttClientConfig, Type?, IEndpointsConfigurationBuilder?)
Initializes a new instance of the MqttProducerEndpointBuilder class.
Declaration
public MqttProducerEndpointBuilder(MqttClientConfig clientConfig, Type? messageType = null, IEndpointsConfigurationBuilder? endpointsConfigurationBuilder = null)
Parameters
| Type | Name | Description |
|---|---|---|
| MqttClientConfig | clientConfig | The MqttClientConfig. |
| Type | messageType | The type of the message being produced. |
| IEndpointsConfigurationBuilder | endpointsConfigurationBuilder | The optional reference to the IEndpointsConfigurationBuilder that instantiated the builder. |
Properties
| Improve this doc View sourceThis
Gets this instance.
Declaration
protected override IMqttProducerEndpointBuilder This { get; }
Property Value
| Type | Description |
|---|---|
| IMqttProducerEndpointBuilder |
Overrides
Remarks
This is necessary to work around casting in the base classes.
Methods
| Improve this doc View sourceConfigure(Action<IMqttClientConfigBuilder>)
Configures the MQTT client properties.
Declaration
public IMqttProducerEndpointBuilder Configure(Action<IMqttClientConfigBuilder> configBuilderAction)
Parameters
| Type | Name | Description |
|---|---|---|
| Action<IMqttClientConfigBuilder> | configBuilderAction | An Action<T> that takes the IMqttClientConfigBuilder and configures it. |
Returns
| Type | Description |
|---|---|
| IMqttProducerEndpointBuilder | The IMqttProducerEndpointBuilder so that additional calls can be chained. |
Configure(Action<MqttClientConfig>)
Configures the MQTT client properties.
Declaration
public IMqttProducerEndpointBuilder Configure(Action<MqttClientConfig> configAction)
Parameters
| Type | Name | Description |
|---|---|---|
| Action<MqttClientConfig> | configAction | An Action<T> that takes the MqttClientConfig and configures it. |
Returns
| Type | Description |
|---|---|
| IMqttProducerEndpointBuilder | The IMqttProducerEndpointBuilder so that additional calls can be chained. |
CreateEndpoint()
Creates the endpoint to be configured according to the options stored in the builder.
Declaration
protected override MqttProducerEndpoint CreateEndpoint()
Returns
| Type | Description |
|---|---|
| MqttProducerEndpoint | The endpoint. |
Overrides
| Improve this doc View sourceProduceTo(Func<IOutboundEnvelope, IServiceProvider, string?>)
Specifies the name of the topic and optionally the target partition.
Declaration
public IMqttProducerEndpointBuilder ProduceTo(Func<IOutboundEnvelope, IServiceProvider, string?> topicNameFunction)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<IOutboundEnvelope, IServiceProvider, string> | topicNameFunction | The function returning the topic name for the message being produced. If the function returns
|
Returns
| Type | Description |
|---|---|
| IMqttProducerEndpointBuilder | The IMqttProducerEndpointBuilder so that additional calls can be chained. |
ProduceTo(Func<IOutboundEnvelope, string?>)
Specifies the name of the topic and optionally the target partition.
Declaration
public IMqttProducerEndpointBuilder ProduceTo(Func<IOutboundEnvelope, string?> topicNameFunction)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<IOutboundEnvelope, string> | topicNameFunction | The function returning the topic name for the message being produced. If the function returns
|
Returns
| Type | Description |
|---|---|
| IMqttProducerEndpointBuilder | The IMqttProducerEndpointBuilder so that additional calls can be chained. |
ProduceTo(string)
Specifies the name of the topic.
Declaration
public IMqttProducerEndpointBuilder ProduceTo(string topicName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | topicName | The name of the topic. |
Returns
| Type | Description |
|---|---|
| IMqttProducerEndpointBuilder | The IMqttProducerEndpointBuilder so that additional calls can be chained. |
ProduceTo(string, Func<IOutboundEnvelope, string[]>)
Specifies the name of the topic and optionally the target partition.
Declaration
public IMqttProducerEndpointBuilder ProduceTo(string topicNameFormatString, Func<IOutboundEnvelope, string[]> topicNameArgumentsFunction)
Parameters
| Type | Name | Description |
|---|---|---|
| string | topicNameFormatString | The endpoint name format string that will be combined with the arguments returned by the
|
| Func<IOutboundEnvelope, string[]> | topicNameArgumentsFunction | The function returning the arguments to be used to format the string. |
Returns
| Type | Description |
|---|---|
| IMqttProducerEndpointBuilder | The IMqttProducerEndpointBuilder so that additional calls can be chained. |
ProduceTo<TMessage>(Func<IOutboundEnvelope<TMessage>, IServiceProvider, string?>)
Specifies the name of the topic and optionally the target partition.
Declaration
public IMqttProducerEndpointBuilder ProduceTo<TMessage>(Func<IOutboundEnvelope<TMessage>, IServiceProvider, string?> topicNameFunction) where TMessage : class
Parameters
| Type | Name | Description |
|---|---|---|
| Func<IOutboundEnvelope<TMessage>, IServiceProvider, string> | topicNameFunction | The function returning the topic name for the message being produced. If the function returns
|
Returns
| Type | Description |
|---|---|
| IMqttProducerEndpointBuilder | The IMqttProducerEndpointBuilder so that additional calls can be chained. |
Type Parameters
| Name | Description |
|---|---|
| TMessage | The type of the messages being produced. |
ProduceTo<TMessage>(Func<IOutboundEnvelope<TMessage>, string?>)
Specifies the name of the topic and optionally the target partition.
Declaration
public IMqttProducerEndpointBuilder ProduceTo<TMessage>(Func<IOutboundEnvelope<TMessage>, string?> topicNameFunction) where TMessage : class
Parameters
| Type | Name | Description |
|---|---|---|
| Func<IOutboundEnvelope<TMessage>, string> | topicNameFunction | The function returning the topic name for the message being produced. If the function returns
|
Returns
| Type | Description |
|---|---|
| IMqttProducerEndpointBuilder | The IMqttProducerEndpointBuilder so that additional calls can be chained. |
Type Parameters
| Name | Description |
|---|---|
| TMessage | The type of the messages being produced. |
ProduceTo<TMessage>(string, Func<IOutboundEnvelope<TMessage>, string[]>)
Specifies the name of the topic and optionally the target partition.
Declaration
public IMqttProducerEndpointBuilder ProduceTo<TMessage>(string topicNameFormatString, Func<IOutboundEnvelope<TMessage>, string[]> topicNameArgumentsFunction) where TMessage : class
Parameters
| Type | Name | Description |
|---|---|---|
| string | topicNameFormatString | The endpoint name format string that will be combined with the arguments returned by the
|
| Func<IOutboundEnvelope<TMessage>, string[]> | topicNameArgumentsFunction | The function returning the arguments to be used to format the string. |
Returns
| Type | Description |
|---|---|
| IMqttProducerEndpointBuilder | The IMqttProducerEndpointBuilder so that additional calls can be chained. |
Type Parameters
| Name | Description |
|---|---|
| TMessage | The type of the messages being produced. |
Retain()
Specifies that the messages have to be sent with the retain flag, causing them to be persisted on the broker.
Declaration
public IMqttProducerEndpointBuilder Retain()
Returns
| Type | Description |
|---|---|
| IMqttProducerEndpointBuilder | The IMqttProducerEndpointBuilder so that additional calls can be chained. |
UseEndpointNameResolver<TResolver>()
Specifies the type of the IProducerEndpointNameResolver to be used to resolve the actual endpoint name and partition.
Declaration
public IMqttProducerEndpointBuilder UseEndpointNameResolver<TResolver>() where TResolver : IProducerEndpointNameResolver
Returns
| Type | Description |
|---|---|
| IMqttProducerEndpointBuilder | The IMqttProducerEndpointBuilder so that additional calls can be chained. |
Type Parameters
| Name | Description |
|---|---|
| TResolver | The type of the IProducerEndpointNameResolver to be used. |
WithAtLeastOnceQoS()
Specifies that the messages have to be sent with the at least once quality of service level.
Declaration
public IMqttProducerEndpointBuilder WithAtLeastOnceQoS()
Returns
| Type | Description |
|---|---|
| IMqttProducerEndpointBuilder | The IMqttProducerEndpointBuilder 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 IMqttProducerEndpointBuilder WithAtMostOnceQoS()
Returns
| Type | Description |
|---|---|
| IMqttProducerEndpointBuilder | The IMqttProducerEndpointBuilder 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 IMqttProducerEndpointBuilder WithExactlyOnceQoS()
Returns
| Type | Description |
|---|---|
| IMqttProducerEndpointBuilder | The IMqttProducerEndpointBuilder 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 IMqttProducerEndpointBuilder WithMessageExpiration(TimeSpan messageExpiryInterval)
Parameters
| Type | Name | Description |
|---|---|---|
| TimeSpan | messageExpiryInterval | The TimeSpan representing the message expiry interval. |
Returns
| Type | Description |
|---|---|
| IMqttProducerEndpointBuilder | The IMqttProducerEndpointBuilder so that additional calls can be chained. |
WithQualityOfServiceLevel(MqttQualityOfServiceLevel)
Specifies the desired quality of service level.
Declaration
public IMqttProducerEndpointBuilder WithQualityOfServiceLevel(MqttQualityOfServiceLevel qosLevel)
Parameters
| Type | Name | Description |
|---|---|---|
| MqttQualityOfServiceLevel | qosLevel | The MQTTnet.Protocol.MqttQualityOfServiceLevel. |
Returns
| Type | Description |
|---|---|
| IMqttProducerEndpointBuilder | The IMqttProducerEndpointBuilder so that additional calls can be chained. |