alepha@docs:~/docs/packages/alepha$
cat topic.md | pretty1 min read
Last commit:
#Alepha - Topic
#Installation
Part of the alepha package. Import from alepha/topic.
npm install alepha
#Overview
Publish/subscribe messaging for event-driven architectures.
Features:
- Pub/sub topics with type-safe messages
- Topic subscription handlers
- Multiple subscriber support
- Message filtering and routing
- Providers: Redis when
REDIS_URLis set, Memory otherwise
Set REDIS_URL and a message published on one instance reaches every
instance: WebSocket broadcasts, parameter:sync and lock:end included.
Leave it unset and topics stay inside this process. An app's own
TopicProvider substitution wins over both.
#API Reference
#Primitives
$subscriber- Creates a subscriber primitive to listen for messages from a specific topic.$topic- Creates a topic primitive for publish/subscribe messaging and event-driven architecture.
#Providers
RedisTopicProvider- Topics over Redis pub/sub.TopicProvider- Base class for topic providers.