Class MqttDynamicProducerEndpointResolver<TMessage>
- Namespace
- Silverback.Messaging.Producing.EndpointResolvers
- Assembly
- Silverback.Integration.MQTT.dll
Dynamically resolves the target topic for each message being produced.
public sealed record MqttDynamicProducerEndpointResolver<TMessage> : DynamicProducerEndpointResolver<TMessage, MqttProducerEndpoint, MqttProducerEndpointConfiguration>, IDynamicProducerEndpointResolver<MqttProducerEndpoint>, IDynamicProducerEndpointResolver, IProducerEndpointResolver<MqttProducerEndpoint>, IProducerEndpointResolver, IEquatable<DynamicProducerEndpointResolver<TMessage, MqttProducerEndpoint, MqttProducerEndpointConfiguration>>, IEquatable<MqttDynamicProducerEndpointResolver<TMessage>> where TMessage : class
Type Parameters
TMessageThe type of the message being produced.
- Inheritance
-
MqttDynamicProducerEndpointResolver<TMessage>
- Implements
-
IEquatable<DynamicProducerEndpointResolver<TMessage, MqttProducerEndpoint, MqttProducerEndpointConfiguration>>IEquatable<MqttDynamicProducerEndpointResolver<TMessage>>
- Inherited Members
Constructors
MqttDynamicProducerEndpointResolver(Func<IOutboundEnvelope<TMessage>, string>)
Initializes a new instance of the MqttDynamicProducerEndpointResolver<TMessage> class.
public MqttDynamicProducerEndpointResolver(Func<IOutboundEnvelope<TMessage>, string> topicFunction)
Parameters
topicFunctionFunc<IOutboundEnvelope<TMessage>, string>The function returning the target topic for the message being produced.
MqttDynamicProducerEndpointResolver(Func<TMessage?, string>)
Initializes a new instance of the MqttDynamicProducerEndpointResolver<TMessage> class.
public MqttDynamicProducerEndpointResolver(Func<TMessage?, string> topicFunction)
Parameters
topicFunctionFunc<TMessage, string>The function returning the target topic for the message being produced.
MqttDynamicProducerEndpointResolver(string, Func<IOutboundEnvelope<TMessage>, string[]>)
Initializes a new instance of the MqttDynamicProducerEndpointResolver<TMessage> class.
public MqttDynamicProducerEndpointResolver(string topicFormatString, Func<IOutboundEnvelope<TMessage>, string[]> topicArgumentsFunction)
Parameters
topicFormatStringstringThe topic format string that will be combined with the arguments returned by the
topicArgumentsFunctionusing a Format(string, params object[]).topicArgumentsFunctionFunc<IOutboundEnvelope<TMessage>, string[]>The function returning the arguments to be used to format the string.
MqttDynamicProducerEndpointResolver(string, Func<TMessage?, string[]>)
Initializes a new instance of the MqttDynamicProducerEndpointResolver<TMessage> class.
public MqttDynamicProducerEndpointResolver(string topicFormatString, Func<TMessage?, string[]> topicArgumentsFunction)
Parameters
topicFormatStringstringThe topic format string that will be combined with the arguments returned by the
topicArgumentsFunctionusing a Format(string, params object[]).topicArgumentsFunctionFunc<TMessage, string[]>The function returning the arguments to be used to format the string.
Properties
EqualityContract
protected override Type EqualityContract { get; }
Property Value
Methods
DeserializeEndpoint(string, MqttProducerEndpointConfiguration)
Deserializes the endpoint from a string.
protected override MqttProducerEndpoint DeserializeEndpoint(string serializedEndpoint, MqttProducerEndpointConfiguration configuration)
Parameters
serializedEndpointstringThe serialized endpoint.
configurationMqttProducerEndpointConfigurationThe endpoint configuration.
Returns
- MqttProducerEndpoint
The deserialized endpoint.
Equals(DynamicProducerEndpointResolver<TMessage, MqttProducerEndpoint, MqttProducerEndpointConfiguration>?)
public override sealed bool Equals(DynamicProducerEndpointResolver<TMessage, MqttProducerEndpoint, MqttProducerEndpointConfiguration>? other)
Parameters
otherDynamicProducerEndpointResolver<TMessage, MqttProducerEndpoint, MqttProducerEndpointConfiguration>
Returns
Equals(MqttDynamicProducerEndpointResolver<TMessage>?)
public bool Equals(MqttDynamicProducerEndpointResolver<TMessage>? other)
Parameters
otherMqttDynamicProducerEndpointResolver<TMessage>
Returns
Equals(object?)
public override bool Equals(object? obj)
Parameters
objobject
Returns
GetEndpointCore(IOutboundEnvelope<TMessage>, MqttProducerEndpointConfiguration)
Gets the computed actual destination endpoint for the message being produced.
protected override MqttProducerEndpoint GetEndpointCore(IOutboundEnvelope<TMessage> envelope, MqttProducerEndpointConfiguration configuration)
Parameters
envelopeIOutboundEnvelope<TMessage>The envelope containing the message to be produced.
configurationMqttProducerEndpointConfigurationThe endpoint configuration.
Returns
- MqttProducerEndpoint
The ProducerEndpoint for the specified message.
GetHashCode()
public override int GetHashCode()
Returns
PrintMembers(StringBuilder)
protected override bool PrintMembers(StringBuilder builder)
Parameters
builderStringBuilder
Returns
SerializeEndpoint(MqttProducerEndpoint)
Serializes the endpoint to a string.
protected override string SerializeEndpoint(MqttProducerEndpoint endpoint)
Parameters
endpointMqttProducerEndpointThe endpoint to be serialized.
Returns
- string
The serialized endpoint.
ToString()
public override string ToString()
Returns
Operators
operator ==(MqttDynamicProducerEndpointResolver<TMessage>?, MqttDynamicProducerEndpointResolver<TMessage>?)
public static bool operator ==(MqttDynamicProducerEndpointResolver<TMessage>? left, MqttDynamicProducerEndpointResolver<TMessage>? right)
Parameters
leftMqttDynamicProducerEndpointResolver<TMessage>rightMqttDynamicProducerEndpointResolver<TMessage>
Returns
operator !=(MqttDynamicProducerEndpointResolver<TMessage>?, MqttDynamicProducerEndpointResolver<TMessage>?)
public static bool operator !=(MqttDynamicProducerEndpointResolver<TMessage>? left, MqttDynamicProducerEndpointResolver<TMessage>? right)
Parameters
leftMqttDynamicProducerEndpointResolver<TMessage>rightMqttDynamicProducerEndpointResolver<TMessage>