macula_pubsub_server (macula v0.20.5)
View SourcePub/Sub GenServer - manages subscriptions and message delivery. Ties together registry, cache, discovery, and delivery layers.
Summary
Functions
Get cache statistics.
List all unique patterns.
List all subscriptions.
Publish message to all matching subscribers.
Start server with default options.
Start server with options.
Stop server.
Subscribe to a pattern.
Get subscription count.
Unsubscribe from a pattern.
Types
-type options() :: #{cache_size => pos_integer(), cache_ttl => pos_integer(), discovery_fun => macula_pubsub_discovery:dht_lookup_fun(), send_fun => macula_pubsub_delivery:send_fun()}.
Functions
-spec cache_stats(pid()) -> #{size := non_neg_integer(), max_size := pos_integer()}.
Get cache statistics.
List all unique patterns.
-spec list_subscriptions(pid()) -> [macula_pubsub_registry:subscription()].
List all subscriptions.
-spec publish(pid(), macula_pubsub_delivery:message()) -> ok.
Publish message to all matching subscribers.
Start server with default options.
Start server with options.
-spec stop(pid()) -> ok.
Stop server.
Subscribe to a pattern.
-spec subscription_count(pid()) -> non_neg_integer().
Get subscription count.
Unsubscribe from a pattern.