-
Notifications
You must be signed in to change notification settings - Fork 13
Introduce EventPublisher trait. #51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jkczyz
reviewed
Mar 12, 2025
e0e071f
to
46141ea
Compare
Squashed fixups to make review easier. |
46141ea
to
1a80e39
Compare
jkczyz
reviewed
Mar 13, 2025
jkczyz
reviewed
Mar 14, 2025
jkczyz
reviewed
Mar 17, 2025
jkczyz
reviewed
Mar 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Please squash.
The LDK Server needs a flexible and reliable mechanism to publish informational events (e.g., transaction updates, channel status changes) to external messaging systems to integration with other external services in a decoupled manner. To achieve this, we introduce the EventPublisher trait, which defines a consistent, asynchronous interface for event publishing. This allows the daemon to support multiple messaging backends (e.g., RabbitMQ, Kafka, AWS SQS) via feature flags. Since underlying messaging systems are expected to support durable buffering, this keeps the LDK Server decoupled from event storage and handling, while enabling multiple consumers to process events independently. This is in contrast with in-memory event queues, polling, or WebSockets, since they either lack durability, tightly couple the daemon to consumers, or require constant connectivity. In-memory queues risk losing events on restart, polling burdens the daemon with service calls from each consumer, and WebSockets demand real-time client availability—none of which support multiple consumers efficiently.
Introduces a NoopEventPublisher that implements the EventPublisher trait, but performs no actions when publishing events. It will serve as a convenient default implementation for scenarios where no real event publishing mechanism is required, reducing the burden on developers to provide an explicit publisher in all cases.
For now, we publish only `PaymentForwarded` event, but similar mechanism will be used to publish other event types.
b22d67f
to
5ffb7d8
Compare
Squashed fixups ! |
jkczyz
approved these changes
Mar 18, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The LDK Server needs a flexible and reliable mechanism to publish informational events (e.g., transaction updates, channel status changes) to external messaging systems for integration with other external services in a decoupled manner.
To achieve this, we introduce the EventPublisher trait, which defines a trait for event publishing. This allows the daemon to support multiple messaging backends via feature flags.
Since underlying messaging systems are expected to support durable buffering, this keeps the LDK Server decoupled from event storage and handling, while enabling multiple consumers to process events independently.
This is in contrast with in-memory event queues, polling, or WebSockets, since they either lack durability, tightly couple the daemon to consumers, or require constant connectivity. In-memory queues risk losing events on restart, polling burdens the daemon with service calls from each consumer, and WebSockets demand real-time client availability—none of which efficiently support multiple consumers or can scale effectively.
Note: Feature flags enable optional messaging backends, minimizing dependencies and avoiding restriction to a specific messaging system for users.
As part of #37