Skip to content

Commit 960c2c8

Browse files
authored
Outbox allow to return status (#295)
* outbox allow to return status * outbox allow to return status * prepare new version and docu * wip --------- Co-authored-by: Max Gruenfelder <maximilian.gruenfelder@sap.com>
1 parent 32a842d commit 960c2c8

File tree

8 files changed

+256
-114
lines changed

8 files changed

+256
-114
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
66
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
77

8+
## v1.9.0 - 2025-02-18
9+
10+
### Added
11+
12+
- CAP outbox: allow to return the event status. [Documentation](https://cap-js-community.github.io/event-queue/use-as-cap-outbox/#how-to-return-a-custom-status)
13+
- Keep alive handling to reduce the time after which events are restarted after a server crash.
14+
815
## v1.8.7 - 2025-02-05
916

1017
### Added

docs/configure-event/index.md

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@ nav_order: 4
1010

1111
# Configure Events
1212

13-
<!-- prettier-ignore -->
14-
1513
- TOC
16-
{: toc}
14+
{: toc}
1715

1816
<!-- prettier-ignore-end -->
1917

@@ -49,6 +47,7 @@ The configuration YAML file is where all the required information regarding even
4947
| retryFailedAfter | The duration (in milliseconds) after which failed events should be retried, provided the retry limit has not been exceeded. | `5 * 60 * 1000` |
5048
| multiInstanceProcessing | (Currently applicable only for Single Tenant) Allows processing of the same event type and subtype across multiple application instances. | false |
5149
| increasePriorityOverTime | After three minutes, the priority of unprocessed events is increased by one. This behavior can be disabled with this option. The behavior is documented [here](#priority-of-events). | true |
50+
| keepAliveInterval | Specifies the interval (in seconds) at which keep-alive signals are sent during event processing to monitor system health. | 60 |
5251

5352
## Configuration
5453

@@ -98,6 +97,7 @@ instance is overloaded.
9897
| priority | Specifies the priority level of the event. More details can be found [here](#priority-of-events). | Medium |
9998
| appNames | Specifies the application names on which the event should be processed. The application name is extracted from the environment variable `VCAP_APPLICATION`. If not defined, the event is processed on all connected applications. | null |
10099
| appInstances | Specifies the application instance numbers on which the event should be processed. The instance number is extracted from the environment variable `CF_INSTANCE_INDEX`. If not defined, the event is processed on all instances of the connected applications. | null |
100+
| keepAliveInterval | Specifies the interval (in seconds) at which keep-alive signals are sent during event processing to monitor system health. | 60 |
101101

102102
## Configuration
103103

@@ -327,3 +327,23 @@ To ensure that event types with low priorities are not left unprocessed during p
327327
adjustment is made for event types in the queue for more than three minutes. The pre-defined rule is: if an event type
328328
remains in the queue for more than three minutes, its priority is temporarily bumped up by one level (i.e., from Low to
329329
Medium).
330+
331+
# Keep Alive During Event Processing
332+
333+
The "Keep Alive During Event Processing" feature ensures system reliability by monitoring event processing activities.
334+
335+
## Overview
336+
337+
During the processing of ad-hoc and periodic events, a keep-alive signal is sent to detect application crashes or
338+
unresponsiveness. This enables prompt redirection or restarting of events on different instances if needed.
339+
340+
## Functionality
341+
342+
- Keep-alive signals are periodically sent during event processing, based on event configurations.
343+
- If a keep-alive signal is not received, the system identifies a potential crash.
344+
- Events are restarted on available instances to minimize downtime and ensure continuity.
345+
346+
## Configuration
347+
348+
This parameter specifies the interval, in seconds, at which keep-alive signals are emitted during event processing. The
349+
default value is 60 seconds. Adjusting this parameter can tailor the system's responsiveness to potential failures.

docs/use-as-cap-outbox/index.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,3 +223,13 @@ class TaskService extends cds.Service {
223223
}
224224
}
225225
```
226+
227+
### How to return a custom status?
228+
229+
It's possible to return a custom status for an event. The allowed status values are explained [here](/event-queue/status-handling/).
230+
231+
```js
232+
this.on("returnPlainStatus", (req) => {
233+
return EventProcessingStatus.Done;
234+
});
235+
```

0 commit comments

Comments
 (0)