ExESDBGater.Topics (ex_esdb_gater v0.8.0)
Topic naming utilities for consistent PubSub topic patterns across the ExESDB ecosystem.
This module provides helper functions to generate topic names following the standard pattern: "{store_id}:{sub_topic}" for store-specific events and "cluster:{sub_topic}" for cluster-wide events.
Examples
# Store-specific topics
Topics.store_health(:vehicle_store)
#=> "vehicle_store:health"
Topics.store_streams(:reckon_store)
#=> "reckon_store:streams"
# Cluster-level topics
Topics.cluster_health()
#=> "cluster:health"
Topics.cluster_topology()
#=> "cluster:topology"
Summary
Functions
Generate all standard cluster topics.
Generate all standard topics for a given store.
Generate the cluster alerts topic. Used for cluster-wide alerts and system notifications.
Generate the cluster discovery topic. Used for node discovery and cluster formation events.
Generate the cluster health monitoring topic. Used for cluster-wide health status and node availability.
Generate the cluster leader election topic. Used for leadership changes and coordination events.
Generate the cluster performance topic. Used for cluster-wide performance metrics and monitoring.
Get all predefined cluster-level sub-topic types.
Generate a custom cluster-level topic.
Generate the cluster topology changes topic. Used for node join/leave events and cluster membership changes.
Parse a topic string into its components.
Generate a store-specific alerts topic. Used for publishing store-specific alerts and warnings.
Generate a store-specific events topic. Used for publishing individual event write notifications.
Generate a store-specific health monitoring topic. Used for publishing health status updates for a specific store.
Generate a store-specific lifecycle events topic. Used for publishing store startup, shutdown, and state change events.
Generate a store-specific performance metrics topic. Used for publishing performance and monitoring data.
Generate a store-specific replicas topic. Used for publishing replica status changes, leader elections, etc.
Generate a store-specific streams topic. Used for publishing stream creation, updates, and deletion events.
Get all predefined store-specific sub-topic types.
Generate a store-specific subscriptions topic. Used for publishing subscription lifecycle events.
Generate a custom store-specific topic.
Check if a store ID is valid (non-empty atom).
Validate if a topic follows the expected pattern.
Functions
Generate all standard cluster topics.
Generate all standard topics for a given store.
Examples
Topics.all_store_topics(:vehicle_store)
#=> ["vehicle_store:health", "vehicle_store:lifecycle", ...]
Generate the cluster alerts topic. Used for cluster-wide alerts and system notifications.
Generate the cluster discovery topic. Used for node discovery and cluster formation events.
Generate the cluster health monitoring topic. Used for cluster-wide health status and node availability.
Generate the cluster leader election topic. Used for leadership changes and coordination events.
Generate the cluster performance topic. Used for cluster-wide performance metrics and monitoring.
Get all predefined cluster-level sub-topic types.
Generate a custom cluster-level topic.
Examples
Topics.cluster_topic(:maintenance)
#=> "cluster:maintenance"
Generate the cluster topology changes topic. Used for node join/leave events and cluster membership changes.
Parse a topic string into its components.
Examples
Topics.parse_topic("vehicle_store:health")
#=> {:store, :vehicle_store, :health}
Topics.parse_topic("cluster:topology")
#=> {:cluster, nil, :topology}
Topics.parse_topic("invalid")
#=> {:error, :invalid_format}
Generate a store-specific alerts topic. Used for publishing store-specific alerts and warnings.
Generate a store-specific events topic. Used for publishing individual event write notifications.
Generate a store-specific health monitoring topic. Used for publishing health status updates for a specific store.
Generate a store-specific lifecycle events topic. Used for publishing store startup, shutdown, and state change events.
Generate a store-specific performance metrics topic. Used for publishing performance and monitoring data.
Generate a store-specific replicas topic. Used for publishing replica status changes, leader elections, etc.
Generate a store-specific streams topic. Used for publishing stream creation, updates, and deletion events.
Get all predefined store-specific sub-topic types.
Generate a store-specific subscriptions topic. Used for publishing subscription lifecycle events.
Generate a custom store-specific topic.
Examples
Topics.store_topic(:vehicle_store, :custom_events)
#=> "vehicle_store:custom_events"
Check if a store ID is valid (non-empty atom).
Validate if a topic follows the expected pattern.
Examples
Topics.valid_topic?("vehicle_store:health")
#=> true
Topics.valid_topic?("cluster:topology")
#=> true
Topics.valid_topic?("invalid-format")
#=> false