mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-24 14:43:04 +08:00
Added IMqttRetainedMessagesManager
* Added interface IMqttRetainedMessagesManager to allow for different retained messages manager implementations. The interface copies almost exactly the current MqttRetainedMessagesManager implementation. * Added IMqttRetainedMessagesManager.Start() to configure the provided IMqttRetainedMessagesManager outside the constructor. This method returns Task because some implementations that use external storage may be slow on initialization (e.g., connect to a database). * Modified MqttRetainedMessagesManager to implement new interface.
This commit is contained in:
@@ -57,7 +57,7 @@ namespace MQTTnet.Server
|
||||
_options.DefaultEndpointOptions.IsEnabled = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public MqttServerOptionsBuilder WithEncryptedEndpoint()
|
||||
{
|
||||
_options.TlsEndpointOptions.IsEnabled = true;
|
||||
@@ -118,13 +118,19 @@ namespace MQTTnet.Server
|
||||
return this;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
public MqttServerOptionsBuilder WithStorage(IMqttServerStorage value)
|
||||
{
|
||||
_options.Storage = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MqttServerOptionsBuilder WithRetainedMessagesManager(IMqttRetainedMessagesManager value)
|
||||
{
|
||||
_options.RetainedMessagesManager = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MqttServerOptionsBuilder WithConnectionValidator(IMqttServerConnectionValidator value)
|
||||
{
|
||||
_options.ConnectionValidator = value;
|
||||
|
||||
Reference in New Issue
Block a user