Interface FastMetaBroadcast<LT>

  • Type Parameters:
    LT - local API type that handles responses
    All Superinterfaces:
    io.aether.utils.interfaces.Destroyable

    public interface FastMetaBroadcast<LT>
    extends io.aether.utils.interfaces.Destroyable
    Broadcast UDP client for FastMeta.

    A broadcast client sends a single request datagram to a well-known multicast or broadcast endpoint. Servers listening on that endpoint respond via unicast to the sender address captured from the request, so each response arrives on the same socket the request was sent from.

    Every inbound response is decoded in a fresh MetaContext produced by the broadcast client, with MetaContext.getProperty(int) returning the reply sender address (key 1: remote IP string, key 2: remote port). This makes it possible for the local API implementation to know which server sent each reply and, if needed, to send a unicast reply back.

    Broadcast requests are conceptually one-shot. Each call to send(io.aether.net.fastMeta.FastMetaApi<LT, RT>, io.aether.utils.interfaces.AConsumer<RT>) builds one datagram by invoking methods on a temporary remote API view; any number of servers may then reply over time.

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      io.aether.utils.futures.AFuture ready()  
      <RT extends RemoteApi>
      void
      send​(FastMetaApi<LT,​RT> remoteApiMeta, io.aether.utils.interfaces.AConsumer<RT> reqBuilder)
      Serialize a request through the given remote API definition and broadcast it as a single UDP datagram to the configured endpoint.
      • Methods inherited from interface io.aether.utils.interfaces.Destroyable

        destroy
    • Method Detail

      • ready

        io.aether.utils.futures.AFuture ready()
        Returns:
        a future that completes when the broadcast client is ready to send and receive traffic
      • send

        <RT extends RemoteApi> void send​(FastMetaApi<LT,​RT> remoteApiMeta,
                                         io.aether.utils.interfaces.AConsumer<RT> reqBuilder)
        Serialize a request through the given remote API definition and broadcast it as a single UDP datagram to the configured endpoint.

        The reqBuilder receives a freshly created remote API view. Each method invocation on that view is serialized into a local context, and the resulting bytes are sent as one datagram.

        Type Parameters:
        RT - remote API type
        Parameters:
        remoteApiMeta - remote API definition used to build the request
        reqBuilder - callback that performs the actual remote calls