Skip to content

Commit 292d31a

Browse files
authored
Merge branch 'main' into java-aggregating
2 parents 102bd7d + b58526d commit 292d31a

File tree

4 files changed

+141
-56
lines changed

4 files changed

+141
-56
lines changed

.vitepress/config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ config.rewrites = rewrites
106106
// Add custom capire info to the theme config
107107
config.themeConfig.capire = {
108108
versions: {
109-
java_services: '4.3.2',
110-
java_cds4j: '4.3.2'
109+
java_services: '4.4.0',
110+
java_cds4j: '4.4.0'
111111
},
112112
gotoLinks: []
113113
}

java/outbox.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,73 @@ To be sure that the deployment version has been set correctly, you can find a lo
163163

164164
And finally, if for some reason you don't want to use a version check for a particular outbox collector, you can switch it off via the outbox configuration [<Config java filesOnly>cds.outbox.services.MyCustomOutbox.checkVersion: false</Config>](../java/developing-applications/properties#cds-outbox-services-<key>-checkVersion).
165165

166+
### Outbox for Shared Databases
167+
168+
Currently, CAP Java does not yet support microservices with shared database out of the box, as this can lead to unexpected behavior when different isolated services use the same outboxes.
169+
Since CAP automatically creates two outboxes with a static name — **DefaultOutboxOrdered** and **DefaultOutboxUnordered** — these would be shared across all services which introduces conflicts.
170+
171+
To avoid this, you can apply a manual workaround as follows:
172+
173+
1. Customize the outbox configuration and isolating them via distinct namespaces for each service.
174+
2. Adapt the Audit Log outbox configuration.
175+
3. Adapt the messaging outbox configuration per service.
176+
177+
These steps are described in the following sections.
178+
179+
#### Deactivate Default Outboxes
180+
181+
First, deactivate the two default outboxes and create custom outboxes with configurations tailored to your needs.
182+
183+
```yaml
184+
cds:
185+
outbox:
186+
services:
187+
# deactivate default outboxes
188+
DefaultOutboxUnordered.enabled: false
189+
DefaultOutboxOrdered.enabled: false
190+
# custom outboxes with unique names
191+
Service1CustomOutboxOrdered:
192+
maxAttempts: 10
193+
storeLastError: true
194+
ordered: true
195+
Service1CustomOutboxUnordered:
196+
maxAttempts: 10
197+
storeLastError: true
198+
ordered: false
199+
200+
```
201+
202+
#### Adapt Audit Log Configuration
203+
204+
The **DefaultOutboxUnordered** outbox is automatically used for audit logging. Therefore, you must update the audit log configuration to point to the custom one.
205+
206+
```yaml
207+
cds:
208+
...
209+
auditlog:
210+
outbox.name: Service1CustomOutboxUnordered
211+
```
212+
213+
#### Adapt Messaging Configuration
214+
215+
Next, adapt the messaging configuration of **every** messaging service in the application so that they use the custom-defined outboxes.
216+
217+
```yaml
218+
cds:
219+
messaging:
220+
services:
221+
MessagingService1:
222+
outbox.name: Service1CustomOutboxOrdered
223+
MessagingService2:
224+
outbox.name: Service1CustomOutboxOrdered
225+
```
226+
227+
228+
::: tip Important Note
229+
It is crucial to **deactivate** the default outboxes, and ensure **unique outbox namespaces** in order to achieve proper isolation between services in a shared DB scenario.
230+
:::
231+
232+
166233
## Outboxing CAP Service Events
167234
168235
Outbox services support outboxing of arbitrary CAP services. A typical use case is to outbox remote OData

java/working-with-cql/query-api.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,6 +1483,10 @@ Scalar functions are values that are calculated from other values. This calculat
14831483
.where(e -> e.get("name").substring(2).eq("ter"));
14841484
```
14851485

1486+
* Concat
1487+
1488+
See [`Concat`](#string-expressions) String Expression
1489+
14861490
#### Case-When-Then Expressions
14871491

14881492
Use a case expression to compute a value based on the evaluation of conditions. The following query converts the stock of Books into a textual representation as 'stockLevel':
@@ -1494,6 +1498,17 @@ Select.from(BOOKS).columns(
14941498
.when(b.stock().gt(100)).then("high")
14951499
.orElse("medium").as("stockLevel").type(CdsBaseType.STRING));
14961500
```
1501+
#### String Expressions
1502+
1503+
* Concat
1504+
1505+
Function `concat` creates a string expression to concatenate a specified value to this value.
1506+
1507+
```java
1508+
// SELECT from Author {name || ' - the Author' as author_name : String}
1509+
Select.from(AUTHOR)
1510+
.columns(a -> a.name().concat(" - the Author").as("author_name"));
1511+
```
14971512

14981513
#### Arithmetic Expressions
14991514

package-lock.json

Lines changed: 57 additions & 54 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)