A thread-safe, high-performance event bus for Delphi implementing publish/subscribe with flexible delivery options.
NX Horizon is an event bus library for Delphi that implements the publish/subscribe pattern to decouple publishers and subscribers. It provides a robust, thread-safe foundation for event-driven communication within Delphi applications, supporting various delivery modes and simplifying complex messaging workflows.
Delphi developers building applications that require decoupled, event-driven communication between components, especially those needing thread-safe operations across multiple threads.
Developers choose NX Horizon for its full thread safety, support for any Delphi type as an event, and flexible delivery options (synchronous, asynchronous, and main-thread-context). Its lightweight design prioritizes speed and simplicity without compromising on robustness.
NX Horizon - Event Bus for Delphi
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 TNxHorizon class and default instance are fully thread-safe, allowing safe event posting and subscription from any thread without additional locking, as emphasized in the README.
Supports any Delphi type as an event with generic wrappers, enabling easy integration of existing types and categorized by TypeInfo for precise event routing.
Offers four delivery modes (Sync, Async, MainSync, MainAsync) to handle synchronous, asynchronous, and main-thread-context dispatches, simplifying complex messaging workflows.
Works across all Delphi platforms from XE4 onward, tested on multiple versions including recent ones like 13.0 Florence, ensuring broad compatibility.
Prioritizes speed and simplicity in implementation, avoiding bloat while maintaining a robust dispatching mechanism, as stated in the philosophy section.
Requires careful use of UnsubscribeAsync to avoid modifying the subscription collection during iteration, adding overhead and potential for errors if misused.
Additional bus instances need manual management, and incorrect use of BeginWork/EndWork can lead to deadlocks during WaitFor calls, as warned in the documentation.
Asynchronous dispatching depends on TTask from the Parallel Programming Library, which may have performance issues or incompatibilities in older Delphi versions or with long-running tasks.
Events are not serializable out-of-the-box, limiting use in scenarios requiring event persistence, remote communication, or debugging across application sessions.