Class LocalMessaging

java.lang.Object
dev.moonbridge.messaging.internal.LocalMessaging
All Implemented Interfaces:
AutoCloseable

public final class LocalMessaging extends Object implements AutoCloseable
Host-side scope registry and bounded local message dispatcher. The host owns the supplied scheduler and executors and must keep the completion executor-independent messaging service alive until it is closed. Plugin handlers/listeners run on their scope executor; public operation futures complete on a separate completion executor so closing a plugin executor cannot strand them or run continuations on a transport reader.
  • Field Details

    • MAX_IN_FLIGHT

      public static final int MAX_IN_FLIGHT
      See Also:
    • DEFAULT_REQUEST_TIMEOUT

      public static final Duration DEFAULT_REQUEST_TIMEOUT
    • MAX_REQUEST_TIMEOUT

      public static final Duration MAX_REQUEST_TIMEOUT
  • Constructor Details

  • Method Details

    • openScope

      public Messaging openScope(String owner)
      Opens an exclusively named plugin scope using the host's default callback executor.
    • openScope

      public Messaging openScope(String owner, Executor executor)
      Opens an exclusively named plugin scope using the supplied callback executor.
    • receiveEvent

      public SendResult receiveEvent(Message message)
      Enqueues an inbound event for each active local listener. The result describes only local queue acceptance, not callback success. Queue slots are released if an owner closes while callbacks remain queued, even when its executor discards those callbacks.
    • receiveRequest

      public CompletionStage<Message> receiveRequest(Message request, Duration timeout)
      Dispatches an inbound request and completes with its correlated reply. The deadline includes waiting for the owning callback executor and asynchronous handler completion.
    • subscriptions

      public Map<String,Integer> subscriptions()
      Returns a snapshot of channels and their current local subscription flags.
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable