Class MqttTopicProcessor
- Namespace
- Azure.Iot.Operations.Protocol
- Assembly
- Azure.Iot.Operations.Protocol.dll
Static class holding methods for processing MQTT topics, filters, and patterns.
public static class MqttTopicProcessor
- Inheritance
-
MqttTopicProcessor
- Inherited Members
Methods
DoesTopicMatchFilter(string, string)
public static bool DoesTopicMatchFilter(string topic, string filter)
Parameters
Returns
GetReplacementMap(string, string)
public static Dictionary<string, string> GetReplacementMap(string pattern, string topic)
Parameters
Returns
ResolveTopic(string, IReadOnlyDictionary<string, string>?)
Get an MQTT topic string for publication.
public static string ResolveTopic(string pattern, IReadOnlyDictionary<string, string>? tokenMap1 = null)
Parameters
patternstringThe pattern whose tokens to replace.
tokenMap1IReadOnlyDictionary<string, string>A first replacement map for replacing tokens in the provided pattern.
Returns
- string
The MQTT topic for publication.
Exceptions
- ArgumentException
Thrown if the topic pattern is null or empty.
ValidateTopicPattern(string?, IReadOnlyDictionary<string, string>?, bool, out string, out string?, out string?)
Validates that a topic pattern is valid for use in a Command or Telemetry.
public static PatternValidity ValidateTopicPattern(string? pattern, IReadOnlyDictionary<string, string>? tokenMap, bool requireReplacement, out string errMsg, out string? errToken, out string? errReplacement)
Parameters
patternstringThe topic pattern.
tokenMapIReadOnlyDictionary<string, string>An optional token replacement map.
requireReplacementboolTrue if a replacement value is required for any token in the pattern.
errMsgstringOut parameter to receive error message if validation fails.
errTokenstringOut parameter to receive the value of a missing or invalid token, if any.
errReplacementstringOut parameter to receive the value of a missing or invalid replacement, if any.
Returns
- PatternValidity
A PatternValidity value indicating whether the pattern is valid or the way in which it is invalid.