Immidate publishing #202
Replies: 2 comments
-
|
Hey @Angel-Velkov, thanks for your idea. Let me explain, why this is currently not implemented and will never be. The Core Problem: Transaction Boundaries The idea is to emit immediately during the transaction and fall back to polling on failure. This violates the fundamental principle of the Outbox Pattern: If you emit inside the transaction:
If you emit after commit:
Violation of Polling Publisher Principle The Transactional Outbox Pattern is based on: This guarantees:
The proposal would introduce:
Record Ordering What You Actually Want: Lower Latency Instead of synchronous emit, consider:
The Outbox Pattern deliberately chooses consistency over latency. This is a feature, not a limitation. Side note on Adaptive Polling in Version 1.1.0: This feature will be introduced in v1.1.0, scheduled for release in March. Adaptive Polling dynamically adjusts the polling interval based on workload. It reduces unnecessary database queries during idle periods while maintaining responsiveness under high load. Benefits:
|
Beta Was this translation helpful? Give feedback.
-
|
One more note, we did consider supporting immediate delivery after the transaction commits. However, for now, we intentionally decided to keep the current polling-based approach because it provides better simplicity, scalability, and database efficiency. Why we don’t emit immediately (for now)Our current design works as follows:
This guarantees:
Because ownership is deterministic (partition-based), we avoid competing consumers entirely. What would change with immediate delivery?If we introduced immediate post-transaction emission, we would effectively introduce a second concurrent delivery mechanism:
These two could compete for the same record. To prevent double processing, we would need an ownership mechanism, for example:
While this is feasible, it introduces:
In other words, we move from a clean partition-based ownership model to a competitive ownership model. Trade-offsImmediate delivery would provide lower latency in the happy path, but:
Our current design optimizes for:
Given that the polling interval can already be tuned to low latency, we believe the added complexity is not justified at this time. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Currently, the outbox pattern provides durability through database persistence plus asynchronous polling. However, there's no built-in way to emit events immediately after scheduling while maintaining durability guarantees without risking duplicate processing.
My question is whether we could have a way to emit the event in the same transaction in which it’s persisted. If that synchronous emission fails, the record would remain in the outbox so that the scheduler can pick it up and retry it afterwards.
Beta Was this translation helpful? Give feedback.
All reactions