Interface Service


  • public interface Service
    A service that is controlled by Apollo.
    • Method Detail

      • getServiceName

        String getServiceName()
        Returns the name of this service.
        Returns:
        the name of this service.
      • start

        Service.Instance start​(String... args)
                        throws IOException
        Starts a new instance of this service that is fully initialized.
        Parameters:
        args - Command-line arguments for the service.
        Returns:
        a new instance of this service that is up and running.
        Throws:
        ApolloHelpException - if the user wants to show command-line help and not start the application.
        ApolloCliException - if something else related to CLI parsing failed.
        IOException - if the application could not start for some other reason.
      • start

        Service.Instance start​(String[] args,
                               Map<String,​String> env)
                        throws IOException
        Starts a new instance of this service that is fully initialized. It will pick up the configuration from the *.conf file but can override keys using env.
        Parameters:
        args - Command-line arguments for the service.
        env - Environment variables for the service. These are not additional environment variables, but instead replaces the set of environment variables that Apollo sees, generally used for testing.
        Returns:
        a new instance of this service that is up and running.
        Throws:
        ApolloHelpException - if the user wants to show command-line help and not start the application.
        ApolloCliException - if something else related to CLI parsing failed.
        IOException - if the application could not start for some other reason.
      • start

        Service.Instance start​(String[] args,
                               com.typesafe.config.Config config)
                        throws IOException
        Starts a new instance of this service that is fully initialized. It will initialize the service using the config passed as an argument and the environment variables.
        Parameters:
        args - Command-line arguments for the service.
        config - Configuration for the service.
        Returns:
        a new instance of this service that is up and running.
        Throws:
        ApolloHelpException - if the user wants to show command-line help and not start the application.
        ApolloCliException - if something else related to CLI parsing failed.
        IOException - if the application could not start for some other reason.
      • start

        default Service.Instance start​(String[] args,
                                       com.typesafe.config.Config config,
                                       Set<ApolloModule> extraModules)
                                throws IOException
        Starts a new instance of this service that is fully initialized. It will initialize the service using the config passed as an argument and the environment variables and a set of extra ApolloModule that should always be loaded.
        Parameters:
        args - Command-line arguments for the service.
        config - Configuration for the service.
        extraModules - Set of modules that should be loaded in addition to the ones loaded by the Service.Builder. These modules will be deduplicated against other modules based on ApolloModule.getId().
        Returns:
        a new instance of this service that is up and running.
        Throws:
        ApolloHelpException - if the user wants to show command-line help and not start the application.
        ApolloCliException - if something else related to CLI parsing failed.
        IOException - if the application could not start for some other reason.