Class BackendChannelClient

java.lang.Object
dev.moonbridge.backendchannel.BackendChannelClient
All Implemented Interfaces:
dev.moonbridge.messaging.internal.LocalMessaging.Outbound, AutoCloseable

public final class BackendChannelClient extends Object implements AutoCloseable, dev.moonbridge.messaging.internal.LocalMessaging.Outbound
Java 8-compatible reconnecting transport with process-local messaging scopes.
  • Field Details

  • Constructor Details

    • BackendChannelClient

      public BackendChannelClient(String host, int port, String instanceId, String backendName, String gameAddress, String generation, String keyId, byte[] secret)
    • BackendChannelClient

      public BackendChannelClient(String host, int port, String instanceId, String backendName, String gameAddress, String generation, String keyId, byte[] secret, long heartbeatMillis, long reconnectMinMillis, long reconnectMaxMillis)
  • Method Details

    • messaging

      public dev.moonbridge.messaging.Messaging messaging(String owner)
      Opens a plugin-owned scope on this client's shared control connection.
    • messaging

      public dev.moonbridge.messaging.Messaging messaging(String owner, Executor executor)
      Opens a plugin-owned scope using the supplied callback executor.
    • isRegistered

      public boolean isRegistered()
      Returns true after REGISTERED and until the active connection is lost.
    • awaitRegistered

      public boolean awaitRegistered(long timeout, TimeUnit unit) throws InterruptedException
      Waits for initial registration or a later reconnect.
      Throws:
      InterruptedException
    • getEpoch

      public long getEpoch()
    • getProxyEpoch

      public UUID getProxyEpoch()
    • close

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

      public CompletionStage<dev.moonbridge.messaging.SendResult> send(dev.moonbridge.messaging.Message message)
      Specified by:
      send in interface dev.moonbridge.messaging.internal.LocalMessaging.Outbound
    • request

      public CompletionStage<dev.moonbridge.messaging.Message> request(dev.moonbridge.messaging.Message request, Duration timeout)
      Specified by:
      request in interface dev.moonbridge.messaging.internal.LocalMessaging.Outbound
    • publish

      public CompletionStage<dev.moonbridge.messaging.PublishResult> publish(dev.moonbridge.messaging.Message event)
      Specified by:
      publish in interface dev.moonbridge.messaging.internal.LocalMessaging.Outbound