Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Tracked by #512
jfallows opened this issue Sep 18, 2023 · 0 comments · Fixed by #507
Closed
Tracked by #512

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

jfallows opened this issue Sep 18, 2023 · 0 comments · Fixed by #507
Assignees
Labels
enhancement New feature or request

Comments

@jfallows
Copy link
Contributor

jfallows commented Sep 18, 2023

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
@jfallows jfallows added the enhancement New feature or request label Sep 18, 2023
@bmaidics bmaidics self-assigned this Oct 11, 2023
@bmaidics bmaidics linked a pull request Oct 30, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants