Skip to content

Shard MQTT topic space for client-id specific subset #427

Closed

Description

@jfallows

A subset of the MQTT topic space is often dedicated to client-specific topics, such as /clients/+/# with the + representing a client identity that is typically only accessible by the corresponding client.

By defining such a pattern for client-specific topics, we can ensure that all messages for the same client identity are produced to Kafka on the same topic partition for each mapped Kafka topic.

We support sharding mqtt-sessions Kafka topic, directing the MQTT client to the corresponding Zilla instance in a cluster, so only a subset of the MQTT session state needs to be sent to each Zilla instance and the client is redirected as needed.

Extending this sharding capability to the client-specific subset of the MQTT topic space should use the same approach, ensuring that the affinity for client identity is consistent across topics via co-partitioning.

For example:

mqtt_kafka_proxy0:
  type: mqtt-kafka
  kind: proxy
  options:
    clients:
      - /clients/{identity}/#
  routes:
    - when:
        - publish:
            - topic: /clients/#
      guarded:
        jwt0:
          - publish:clients
      exit: kafka_cache_client0
    - when:
        - subscribe:
            - topic: /clients/#
      guarded:
        jwt0:
          - subscribe:clients
      exit: kafka_cache_client0

Activity

  1. added
    enhancement
    on Sep 18, 2023
  2. self-assigned this
    on Oct 11, 2023
  3. linked a pull request that will close this issueClient topic space #507on Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions