You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: java/outbox.md
+67Lines changed: 67 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -163,6 +163,73 @@ To be sure that the deployment version has been set correctly, you can find a lo
163
163
164
164
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 [<ConfigjavafilesOnly>cds.outbox.services.MyCustomOutbox.checkVersion: false</Config>](../java/developing-applications/properties#cds-outbox-services-<key>-checkVersion).
165
165
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
+
166
233
## Outboxing CAP Service Events
167
234
168
235
Outbox services support outboxing of arbitrary CAP services. A typical use case is to outbox remote OData
See [`Concat`](#string-expressions) StringExpression
1489
+
1486
1490
#### Case-When-ThenExpressions
1487
1491
1488
1492
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':
0 commit comments