Skip to content

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 5 commits into from
Mar 18, 2025
Merged

Conversation

G8XSU
Copy link
Contributor

@G8XSU G8XSU commented Mar 12, 2025

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

@G8XSU G8XSU requested a review from jkczyz March 12, 2025 20:34
@G8XSU G8XSU added the Weekly Goal Someone wants to land this this week label Mar 12, 2025
@G8XSU G8XSU force-pushed the 2025-03-12-events branch from e0e071f to 46141ea Compare March 13, 2025 18:48
@G8XSU
Copy link
Contributor Author

G8XSU commented Mar 13, 2025

Squashed fixups to make review easier.

@G8XSU G8XSU force-pushed the 2025-03-12-events branch from 46141ea to 1a80e39 Compare March 13, 2025 19:09
@G8XSU G8XSU requested a review from jkczyz March 13, 2025 23:18
@G8XSU G8XSU requested a review from jkczyz March 17, 2025 20:06
@G8XSU G8XSU requested a review from jkczyz March 18, 2025 19:13
Copy link

@jkczyz jkczyz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Please squash.

G8XSU added 4 commits March 18, 2025 12:23
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.
@G8XSU G8XSU force-pushed the 2025-03-12-events branch from b22d67f to 5ffb7d8 Compare March 18, 2025 19:24
@G8XSU
Copy link
Contributor Author

G8XSU commented Mar 18, 2025

Squashed fixups !

@G8XSU G8XSU requested a review from jkczyz March 18, 2025 19:24
@G8XSU G8XSU merged commit c814064 into lightningdevkit:main Mar 18, 2025
6 checks passed
This was referenced Mar 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Weekly Goal Someone wants to land this this week
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants