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

all_cluster_topics()

Generate all standard cluster topics.

all_store_topics(store_id)

Generate all standard topics for a given store.

Examples

Topics.all_store_topics(:vehicle_store)
#=> ["vehicle_store:health", "vehicle_store:lifecycle", ...]

cluster_alerts()

Generate the cluster alerts topic. Used for cluster-wide alerts and system notifications.

cluster_discovery()

Generate the cluster discovery topic. Used for node discovery and cluster formation events.

cluster_health()

Generate the cluster health monitoring topic. Used for cluster-wide health status and node availability.

cluster_leader()

Generate the cluster leader election topic. Used for leadership changes and coordination events.

cluster_performance()

Generate the cluster performance topic. Used for cluster-wide performance metrics and monitoring.

cluster_sub_topics()

Get all predefined cluster-level sub-topic types.

cluster_topic(sub_topic)

Generate a custom cluster-level topic.

Examples

Topics.cluster_topic(:maintenance)
#=> "cluster:maintenance"

cluster_topology()

Generate the cluster topology changes topic. Used for node join/leave events and cluster membership changes.

parse_topic(topic)

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}

store_alerts(store_id)

Generate a store-specific alerts topic. Used for publishing store-specific alerts and warnings.

store_events(store_id)

Generate a store-specific events topic. Used for publishing individual event write notifications.

store_health(store_id)

Generate a store-specific health monitoring topic. Used for publishing health status updates for a specific store.

store_lifecycle(store_id)

Generate a store-specific lifecycle events topic. Used for publishing store startup, shutdown, and state change events.

store_performance(store_id)

Generate a store-specific performance metrics topic. Used for publishing performance and monitoring data.

store_replicas(store_id)

Generate a store-specific replicas topic. Used for publishing replica status changes, leader elections, etc.

store_streams(store_id)

Generate a store-specific streams topic. Used for publishing stream creation, updates, and deletion events.

store_sub_topics()

Get all predefined store-specific sub-topic types.

store_subscriptions(store_id)

Generate a store-specific subscriptions topic. Used for publishing subscription lifecycle events.

store_topic(store_id, sub_topic)

Generate a custom store-specific topic.

Examples

Topics.store_topic(:vehicle_store, :custom_events)
#=> "vehicle_store:custom_events"

valid_store_id?(store_id)

Check if a store ID is valid (non-empty atom).

valid_topic?(topic)

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