Package com.sap.cds.services.outbox
Interface OutboxService
- All Superinterfaces:
Service
Defines the outbox service API. The outbox can be used to couple emitting of
events on a service to the currently active transaction.
The following applies when using the outbox:
- The outbox message is stored in the outbox.
- If the transaction fails, the outbox message is not stored in the outbox and is never emitted.
- A persisted outbox message is emitted eventually (asynchronously or synchronously, depending on the outbox implementation)
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescription<S extends Service>
Soutboxed
(S service) Returns a wrapper around the given service that executes asynchronously by submiting all events to this outbox instance.void
submit
(String outboxEvent, OutboxMessage message) Stores the givenOutboxMessage
under the given outbox event in the outbox.static <S extends Service>
Sunboxed
(S service) Returns the underlying service of the outbox wrapped service.
-
Field Details
-
PERSISTENT_ORDERED_NAME
- See Also:
-
PERSISTENT_UNORDERED_NAME
- See Also:
-
INMEMORY_NAME
- See Also:
-
-
Method Details
-
unboxed
Returns the underlying service of the outbox wrapped service. The returned service instance is the underlying outbox-independent instance executing synchronously.- Type Parameters:
S
- the type of service- Parameters:
service
- the service to unwrap from outbox wrapping- Returns:
- the underlying service of the outbox wrapped service.
-
submit
Stores the givenOutboxMessage
under the given outbox event in the outbox.- Parameters:
outboxEvent
- the outbox event with which the message is stored and again published by theOutboxService
message
- theOutboxMessage
stored and again published by theOutboxService
-
outboxed
Returns a wrapper around the given service that executes asynchronously by submiting all events to this outbox instance. The returned instance can be cached, reused and is thread-safe. If the passed service is already wrapped with this outbox, the passed service is returned. If the passed service is wrapped by another outbox, a new wrapper for the underlying service is returned.- Type Parameters:
S
- the type of service- Parameters:
service
- the service to be outboxed- Returns:
- a wrapper around the given service that executes asynchronously by submiting all events to this outbox instance.
-