Interface OutboxService

All Superinterfaces:
Service

public interface OutboxService extends 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 Details

  • Method Details

    • unboxed

      static <S extends Service> S unboxed(S service)
      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

      void submit(String outboxEvent, OutboxMessage message)
      Stores the given OutboxMessage under the given outbox event in the outbox.
      Parameters:
      outboxEvent - the outbox event with which the message is stored and again published by the OutboxService
      message - the OutboxMessage stored and again published by the OutboxService
    • outboxed

      <S extends Service> S outboxed(S service)
      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.