Class OutboxUtils

java.lang.Object
com.sap.cds.services.utils.outbox.OutboxUtils

public class OutboxUtils extends Object
  • Field Details

  • 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 and false otherwise.
    • outboxed

      public static <S extends Service> S outboxed(S service, String outboxName, CdsRuntime runtime)
      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 outbox
      outboxName - the name of the preferred outbox
      runtime - the CdsRuntime
      Returns:
      the outbox-wrapped service, if a outbox was available
    • toOutboxMessage

      public static OutboxMessage toOutboxMessage(EventContext context)
      Turns the EventContext generically into a OutboxMessage
      Parameters:
      context - the EventContext
      Returns:
      the OutboxMessage
    • toEventContext

      public static EventContext toEventContext(OutboxMessageEventContext outboxContext)
      Turns a OutboxMessageEventContext and its OutboxMessage generically into an EventContext
      Parameters:
      outboxContext - the OutboxMessageEventContext
      Returns:
      the EventContext
    • storeRequestContext

      public static void storeRequestContext(RequestContext requestContext, OutboxMessage message)
    • restoreRequestContext

      public static void restoreRequestContext(RequestContextRunner requestContextRunner, OutboxMessage message)