Class Server

  • All Implemented Interfaces:

    
    public final class Server
    
                        

    Connects this JVM process to the Airflow coordinator and dispatches task execution requests to the registered Bundle.

    The typical entry point is:

    public static void main(String[] args) {
        Server.create(args).serve(new MyBundleBuilder().build());
    }

    The process exits when the coordinator closes the connection (normally after one task-instance execution).

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
      Server(InetSocketAddress comm, InetSocketAddress logs)
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final Unit serve(Bundle bundle) Blocking entry point: connects to the coordinator and serves task-execution requests from the given bundle.
      final Job serveAsync(Bundle bundle) Suspending entry point: connects to the coordinator and serves task-execution requests from the given bundle.
      final static Server create(Array<String> args) Parses coordinator addresses from command-line arguments and returns a ready-to-use Server.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Server

        Server(InetSocketAddress comm, InetSocketAddress logs)
    • Method Detail

      • serve

         final Unit serve(Bundle bundle)

        Blocking entry point: connects to the coordinator and serves task-execution requests from the given bundle.

        This is a convenience wrapper around serveAsync for use from a plain main method. Prefer serveAsync when calling from an existing coroutine. The call returns when the coordinator closes the connection (normally after one task-instance execution).

        Parameters:
        bundle - Bundle containing all Dags this process can execute.
      • serveAsync

         final Job serveAsync(Bundle bundle)

        Suspending entry point: connects to the coordinator and serves task-execution requests from the given bundle.

        Opens both the task-execution channel (--comm) and the log-forwarding channel (--logs) concurrently, then processes incoming requests until the coordinator closes the connection (normally after one task-instance execution). The coroutine returns once both channels have been closed.

        Use this variant when calling from an existing coroutine scope; use the blocking serve from a plain main method.

        Parameters:
        bundle - Bundle containing all Dags this process can execute.
      • create

         final static Server create(Array<String> args)

        Parses coordinator addresses from command-line arguments and returns a ready-to-use Server.

        The arguments are supplied automatically by Airflow and are not intended to be constructed by hand:

        • --comm host:port address for task-execution messages.

        • --logs host:port address for log forwarding.

        Parameters:
        args - Command-line arguments as received by main.
        Returns:

        A configured Server ready to call serve.