Class DurableQueueBuilder

java.lang.Object
org.j7m.middleware.messaging.DurableQueueBuilder

public final class DurableQueueBuilder extends Object
Builder for LogBackedDurableQueue.

Durable logs created from directory(Path) are owned by the queue and closed with it. Durable logs supplied through durableLog(DurableLog) are borrowed by default and remain the caller's responsibility unless ownedDurableLog(DurableLog) is used. Instances are mutable and not thread-safe.

  • Constructor Details

    • DurableQueueBuilder

      public DurableQueueBuilder()
      Creates a builder.
  • Method Details

    • durableLog

      public DurableQueueBuilder durableLog(org.j7m.middleware.api.durablelog.DurableLog value)
      Sets an existing durable log.
      Parameters:
      value - durable log to use
      Returns:
      this builder
    • ownedDurableLog

      public DurableQueueBuilder ownedDurableLog(org.j7m.middleware.api.durablelog.DurableLog value)
      Sets an existing durable log that will be closed by the queue.
      Parameters:
      value - durable log to use and close
      Returns:
      this builder
    • directory

      public DurableQueueBuilder directory(Path value)
      Sets a directory for a new file durable log.
      Parameters:
      value - log directory
      Returns:
      this builder
    • queueOptions

      public DurableQueueBuilder queueOptions(org.j7m.middleware.api.messaging.QueueOptions value)
      Sets queue options.
      Parameters:
      value - queue options
      Returns:
      this builder
    • outboxOptions

      public DurableQueueBuilder outboxOptions(org.j7m.middleware.api.messaging.OutboxOptions value)
      Sets outbox options.
      Parameters:
      value - outbox options
      Returns:
      this builder
    • inboxOptions

      public DurableQueueBuilder inboxOptions(org.j7m.middleware.api.messaging.InboxOptions value)
      Sets inbox options.
      Parameters:
      value - inbox options
      Returns:
      this builder
    • clock

      public DurableQueueBuilder clock(Clock value)
      Sets the clock.
      Parameters:
      value - clock used by queue time semantics
      Returns:
      this builder
    • build

      public LogBackedDurableQueue build()
      Builds and recovers the queue service.
      Returns:
      recovered queue service
      Throws:
      IllegalArgumentException - when neither directory nor durable log is configured