Class MqttLastWillMessageBuilder
Builds the last will and testament (LWT) message related part of the MqttClientConfig.
Implements
Inherited Members
Namespace: Silverback.Messaging.Configuration.Mqtt
Assembly: Silverback.Integration.MQTT.dll
Syntax
public class MqttLastWillMessageBuilder : IMqttLastWillMessageBuilder
Methods
| Improve this doc View sourceAddUserProperty(string, string)
Adds a user property to be sent with the will message.
Declaration
public IMqttLastWillMessageBuilder AddUserProperty(string name, string value)
Parameters
Type | Name | Description |
---|---|---|
string | name | The property name. |
string | value | The property value. |
Returns
Type | Description |
---|---|
IMqttLastWillMessageBuilder | The IMqttLastWillMessageBuilder so that additional calls can be chained. |
Build(MqttClientOptionsBuilder)
Build the will message into the specified options builder.
Declaration
public void Build(MqttClientOptionsBuilder builder)
Parameters
Type | Name | Description |
---|---|---|
MqttClientOptionsBuilder | builder | The MQTTnet.Client.MqttClientOptionsBuilder. |
Message(object)
Specifies the LWT message to be published.
Declaration
public IMqttLastWillMessageBuilder Message(object message)
Parameters
Type | Name | Description |
---|---|---|
object | message | The actual LWT message to be published. |
Returns
Type | Description |
---|---|
IMqttLastWillMessageBuilder | The IMqttLastWillMessageBuilder so that additional calls can be chained. |
ProduceTo(string)
Specifies the name of the topic to produce the LWT message to.
Declaration
public IMqttLastWillMessageBuilder ProduceTo(string topicName)
Parameters
Type | Name | Description |
---|---|---|
string | topicName | The name of the topic. |
Returns
Type | Description |
---|---|
IMqttLastWillMessageBuilder | The IMqttLastWillMessageBuilder so that additional calls can be chained. |
Retain()
Specifies that the LWT message will be sent with the retain flag, causing it to be persisted on the broker.
Declaration
public IMqttLastWillMessageBuilder Retain()
Returns
Type | Description |
---|---|
IMqttLastWillMessageBuilder | The IMqttLastWillMessageBuilder so that additional calls can be chained. |
SerializeAsJson(Action<IJsonMessageSerializerBuilder>?)
Sets the serializer to an instance of JsonMessageSerializer (or JsonMessageSerializer<TMessage>) to serialize the produced messages as JSON.
Declaration
public IMqttLastWillMessageBuilder SerializeAsJson(Action<IJsonMessageSerializerBuilder>? serializerBuilderAction = null)
Parameters
Type | Name | Description |
---|---|---|
Action<IJsonMessageSerializerBuilder> | serializerBuilderAction | An optional Action<T> that takes the IJsonMessageSerializerBuilder and configures it. |
Returns
Type | Description |
---|---|
IMqttLastWillMessageBuilder | The IMqttLastWillMessageBuilder so that additional calls can be chained. |
SerializeUsing(IMessageSerializer)
Specifies the IMessageSerializer to be used to serialize the LWT message.
Declaration
public IMqttLastWillMessageBuilder SerializeUsing(IMessageSerializer serializer)
Parameters
Type | Name | Description |
---|---|---|
IMessageSerializer | serializer | The IMessageSerializer. |
Returns
Type | Description |
---|---|
IMqttLastWillMessageBuilder | The IMqttLastWillMessageBuilder so that additional calls can be chained. |
WithAtLeastOnceQoS()
Specifies that the LWT message has to be sent with the at least once quality of service level.
Declaration
public IMqttLastWillMessageBuilder WithAtLeastOnceQoS()
Returns
Type | Description |
---|---|
IMqttLastWillMessageBuilder | The IMqttLastWillMessageBuilder so that additional calls can be chained. |
WithAtMostOnceQoS()
Specifies that the LWT message has to be sent with the at most once quality of service level.
Declaration
public IMqttLastWillMessageBuilder WithAtMostOnceQoS()
Returns
Type | Description |
---|---|
IMqttLastWillMessageBuilder | The IMqttLastWillMessageBuilder so that additional calls can be chained. |
WithContentType(string?)
Specifies the content type.
Declaration
public IMqttLastWillMessageBuilder WithContentType(string? contentType)
Parameters
Type | Name | Description |
---|---|---|
string | contentType | The content type. |
Returns
Type | Description |
---|---|
IMqttLastWillMessageBuilder | The IMqttLastWillMessageBuilder so that additional calls can be chained. |
WithCorrelationData(byte[]?)
Specifies the correlation data.
Declaration
public IMqttLastWillMessageBuilder WithCorrelationData(byte[]? correlationData)
Parameters
Type | Name | Description |
---|---|---|
byte[] | correlationData | The correlation data. |
Returns
Type | Description |
---|---|
IMqttLastWillMessageBuilder | The IMqttLastWillMessageBuilder so that additional calls can be chained. |
WithDelay(TimeSpan)
Specifies the LWT message delay.
Declaration
public IMqttLastWillMessageBuilder WithDelay(TimeSpan delay)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | delay | The TimeSpan representing the delay. |
Returns
Type | Description |
---|---|
IMqttLastWillMessageBuilder | The IMqttLastWillMessageBuilder so that additional calls can be chained. |
WithExactlyOnceQoS()
Specifies that the LWT message has to be sent with the exactly once quality of service level.
Declaration
public IMqttLastWillMessageBuilder WithExactlyOnceQoS()
Returns
Type | Description |
---|---|
IMqttLastWillMessageBuilder | The IMqttLastWillMessageBuilder so that additional calls can be chained. |
WithPayloadFormatIndicator(MqttPayloadFormatIndicator)
Specifies the payload format indicator.
Declaration
public IMqttLastWillMessageBuilder WithPayloadFormatIndicator(MqttPayloadFormatIndicator formatIndicator)
Parameters
Type | Name | Description |
---|---|---|
MqttPayloadFormatIndicator | formatIndicator | The format indicator. |
Returns
Type | Description |
---|---|
IMqttLastWillMessageBuilder | The IMqttLastWillMessageBuilder so that additional calls can be chained. |
WithQualityOfServiceLevel(MqttQualityOfServiceLevel)
Specifies the desired quality of service level.
Declaration
public IMqttLastWillMessageBuilder WithQualityOfServiceLevel(MqttQualityOfServiceLevel qosLevel)
Parameters
Type | Name | Description |
---|---|---|
MqttQualityOfServiceLevel | qosLevel | The MQTTnet.Protocol.MqttQualityOfServiceLevel. |
Returns
Type | Description |
---|---|
IMqttLastWillMessageBuilder | The IMqttLastWillMessageBuilder so that additional calls can be chained. |
WithResponseTopic(string?)
Specifies the response topic.
Declaration
public IMqttLastWillMessageBuilder WithResponseTopic(string? topic)
Parameters
Type | Name | Description |
---|---|---|
string | topic | The response topic. |
Returns
Type | Description |
---|---|
IMqttLastWillMessageBuilder | The IMqttLastWillMessageBuilder so that additional calls can be chained. |