Skip to content

Event Queues#2608

Draft
sjvans wants to merge 20 commits into
mainfrom
event-queues-reconciled
Draft

Event Queues#2608
sjvans wants to merge 20 commits into
mainfrom
event-queues-reconciled

Conversation

@sjvans
Copy link
Copy Markdown
Contributor

@sjvans sjvans commented Jun 2, 2026

No description provided.

* **Inbox** → for asynchronously handling inbound requests
* **Background tasks** → e.g., scheduled periodically
* **Remote Callbacks** → implementing SAGA patterns
@Before(entity = DeadOutboxMessages_.CDS_NAME)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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) => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it's not explained what result contains:
The return value of the event handler OR
The response object

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants