Allows testing whether an exact topic matches a pattern topic. The pattern topic may contain wildcard segments.

Topics are case-sensitive and consist of one or more segments, each separated by a forward slash.

Hierarchy

  • TopicMatcher

Constructors

Methods

Constructors

  • Constructs a matcher that will match given topics against this pattern.

    Parameters

    • pattern: string

      Pattern to match topics. The pattern is a topic, not a regular expression; thus, it must consist of one or more segments, each separated by a forward slash. The pattern supports wildcard segments beginning with a colon (:). Wildcard segments act as a placeholder for any segment value.

    Returns TopicMatcher

Methods

  • Attempts to match the given topic against the pattern which was passed to the constructor.

    If the match succeeds, then MatcherResult.matches evaluates to true. If the pattern contains wildcard segments, the matched segments can be read using the property TopicMessage.params property.

    Parameters

    • topic: string

      The topic to match against the configured pattern; must be an exact topic, thus not contain wildcard segments.

    Returns MatcherResult

    The result of the topic matcher test.

Generated using TypeDoc