Event Queues#2608
Conversation
| * **Inbox** → for asynchronously handling inbound requests | ||
| * **Background tasks** → e.g., scheduled periodically | ||
| * **Remote Callbacks** → implementing SAGA patterns | ||
| @Before(entity = DeadOutboxMessages_.CDS_NAME) |
There was a problem hiding this comment.
Should be:
@before(event = CqnService.EVENT_READ, entity = DeadOutboxMessages_.CDS_NAME)
The handler takes CdsReadEventContext and modifies a CqnSelect query, so it's clearly intended for READ operations. Without event, the annotation matches all events, which is misleading.
| Enable the inbox in your configuration: | ||
|
|
||
| ::: code-group | ||
| ```json [Node.js — package.json] |
There was a problem hiding this comment.
Consider adding a brief note highlighting differences between inboxed and inbox.enabled
| const xflights = cds.unqueued(qd_xflights) | ||
| ``` | ||
| ```java [Java] | ||
| CqnService xflights = outbox.unboxed(outboxedXFlights); |
There was a problem hiding this comment.
The unboxed() method appears to be a static method on OutboxService:
CqnService xflights = OutboxService.unboxed(outboxedXFlights);
| target : String; // Target service/queue name | ||
| msg : LargeString; // Serialized event payload | ||
| attempts : Integer default 0; // Number of processing attempts | ||
| partition : Integer default 0; |
There was a problem hiding this comment.
add comment like "// reserved"
| ::: details When is a message picked up next? | ||
| A pending message is *processable* when all three conditions hold: | ||
|
|
||
| 1. Its scheduled timestamp plus the retry backoff (`attempts × <exponential factor>`) is in the past. |
There was a problem hiding this comment.
The notation attempts × is potentially misleading. The number of attemps is already in - no need to multiply. If multiplying, then it looks like linear function.
exponential_factor(attempts)
or simply
exponential backoff based on attempts
| const xflights = await cds.connect.to('xflights') | ||
|
|
||
| // Called when the queued booking succeeds | ||
| xflights.after('bookFlight/#succeeded', async (result, req) => { |
There was a problem hiding this comment.
it's not explained what result contains:
The return value of the event handler OR
The response object
No description provided.