Package com.spotify.apollo.core
Interface Service
-
public interface Service
A service that is controlled by Apollo.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
Service.Builder
A builder for a new service.static interface
Service.Instance
A running service instance.static interface
Service.Signaller
A way of sending signals to a service instance.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description String
getServiceName()
Returns the name of this service.Service.Instance
start(String... args)
Starts a new instance of this service that is fully initialized.Service.Instance
start(String[] args, com.typesafe.config.Config config)
Starts a new instance of this service that is fully initialized.default Service.Instance
start(String[] args, com.typesafe.config.Config config, Set<ApolloModule> extraModules)
Starts a new instance of this service that is fully initialized.Service.Instance
start(String[] args, Map<String,String> env)
Starts a new instance of this service that is fully initialized.
-
-
-
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 usingenv
.- 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 theconfig
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 theconfig
passed as an argument and the environment variables and a set of extraApolloModule
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 theService.Builder
. These modules will be deduplicated against other modules based onApolloModule.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.
-
-