An Elixir library that transforms PostgreSQL LISTEN/NOTIFY notifications into callback execution.
Boltun is an Elixir library that simplifies working with PostgreSQL's LISTEN/NOTIFY mechanism. It transforms database notifications into callback executions, allowing developers to react to database events in real-time without polling. The library provides a clean, declarative interface for defining which functions should be called when specific notification channels receive messages.
Elixir developers building applications that need real-time reactions to PostgreSQL database events, such as those implementing event-driven architectures or needing immediate updates when data changes.
Developers choose Boltun because it provides a minimal, elegant abstraction over PostgreSQL's native notification system, reducing boilerplate code while maintaining close integration with database capabilities. Its synchronous callback execution and declarative configuration make it predictable and easy to reason about.
Transforms notifications from the Postgres LISTEN/NOTIFY mechanism into callback execution
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
The `listen do` block provides a clean, declarative syntax for mapping PostgreSQL notification channels to callbacks, eliminating manual LISTEN/NOTIFY boilerplate as shown in the README example.
Callbacks are invoked synchronously in the order they were declared, ensuring straightforward debugging and predictable flow, which is explicitly stated in the README.
Leverages PostgreSQL's built-in LISTEN/NOTIFY mechanism, avoiding the complexity and overhead of external messaging systems while keeping the database as the single source of truth.
Connection parameters are provided through familiar Elixir application configuration, following patterns used by libraries like Postgrex for easy setup and maintenance.
All callbacks run synchronously, which can block processing and become a performance limitation under high load or with slow-running callback functions, as there's no built-in parallelism.
The README does not address error recovery or retry logic; if a callback fails or the database connection drops, developers must implement manual handling, increasing complexity.
Tightly coupled to PostgreSQL, making it unsuitable for projects using other databases or requiring multi-database support, which limits flexibility in polyglot environments.