Class OutboxUtils
java.lang.Object
com.sap.cds.services.utils.outbox.OutboxUtils
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
hasOutboxModel
(com.sap.cds.reflect.CdsModel model) Determines whether the outbox model is available.static <S extends Service>
Soutboxed
(S service, String outboxName, CdsRuntime runtime) Wraps the given service with the outbox.static void
restoreRequestContext
(RequestContextRunner requestContextRunner, OutboxMessage message) static void
storeRequestContext
(RequestContext requestContext, OutboxMessage message) static EventContext
toEventContext
(OutboxMessageEventContext outboxContext) static OutboxMessage
toOutboxMessage
(EventContext context) Turns theEventContext
generically into aOutboxMessage
-
Field Details
-
OUTBOX_MODEL
- See Also:
-
-
Constructor Details
-
OutboxUtils
public OutboxUtils()
-
-
Method Details
-
hasOutboxModel
public static boolean hasOutboxModel(com.sap.cds.reflect.CdsModel model) Determines whether the outbox model is available.- Parameters:
model
- CDS model- Returns:
true
if outbox model is available andfalse
otherwise.
-
outboxed
Wraps the given service with the outbox. If the outbox is not available the in-memory outbox is used instead if available. If no outbox is available at all the original service instance is returned.- Type Parameters:
S
- the service type- Parameters:
service
- the service to outboxoutboxName
- the name of the preferred outboxruntime
- theCdsRuntime
- Returns:
- the outbox-wrapped service, if a outbox was available
-
toOutboxMessage
Turns theEventContext
generically into aOutboxMessage
- Parameters:
context
- theEventContext
- Returns:
- the
OutboxMessage
-
toEventContext
- Parameters:
outboxContext
- theOutboxMessageEventContext
- Returns:
- the
EventContext
-
storeRequestContext
-
restoreRequestContext
public static void restoreRequestContext(RequestContextRunner requestContextRunner, OutboxMessage message)
-