Class EurekaRegistryService
- java.lang.Object
-
- org.kiwiproject.registry.eureka.server.EurekaRegistryService
-
- All Implemented Interfaces:
RegistryService
public class EurekaRegistryService extends Object implements RegistryService
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_DATA_CENTER_INFO_CLASS
Funny story ...static String
DEFAULT_DATA_CENTER_NAME
static String
LEASE_DURATION_IN_SECONDS
Key for lease info representing lease duration in seconds.static String
LEASE_RENEWAL_INTERVAL_IN_SECONDS
Key for lease info representing renewal interval in seconds.static int
MAX_AWAIT_REGISTRATION_CONFIRMATION_TRIES
Maximum number of attempts we will make to await confirmation that we're registered with Eureka.static int
MAX_REGISTRATION_ATTEMPTS
Maximum number of attempts we will make trying to register with Eureka (via POST)
-
Constructor Summary
Constructors Constructor Description EurekaRegistryService(EurekaRegistrationConfig config, EurekaRestClient client, org.kiwiproject.base.KiwiEnvironment environment)
EurekaRegistryService(EurekaRegistrationConfig config, EurekaRestClient client, org.kiwiproject.base.KiwiEnvironment environment, org.kiwiproject.retry.SimpleRetryer registerRetryer, org.kiwiproject.retry.SimpleRetryer awaitRetryer, org.kiwiproject.retry.SimpleRetryer updateStatusRetryer, org.kiwiproject.retry.SimpleRetryer unregisterRetryer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ServiceInstance
createCandidateFrom(ServiceInfo serviceInfo)
Creates a newServiceInstance
instance from aServiceInfo
that can be registered with the registry server.ServiceInstance
register(ServiceInstance serviceToRegister)
Registers aServiceInstance
with the registry server and returns a new instance containing information about the registered instance.void
unregister()
Unregisters any registrations that were previously registered.ServiceInstance
updateStatus(ServiceInstance.Status newStatus)
Sends an update to the registry server to inform of a service status change
-
-
-
Field Detail
-
DEFAULT_DATA_CENTER_INFO_CLASS
public static final String DEFAULT_DATA_CENTER_INFO_CLASS
Funny story ... this class doesn't actually exist. It's for "backwards compatibility".See com.netflix.discovery.converters.jackson.DataCenterTypeInfoResolver for details. (NOTE: javadoc annotation not used to avoid unnecessary errors.)
- See Also:
- Constant Field Values
-
DEFAULT_DATA_CENTER_NAME
public static final String DEFAULT_DATA_CENTER_NAME
- See Also:
- Constant Field Values
-
LEASE_DURATION_IN_SECONDS
public static final String LEASE_DURATION_IN_SECONDS
Key for lease info representing lease duration in seconds.- See Also:
- Constant Field Values
-
LEASE_RENEWAL_INTERVAL_IN_SECONDS
public static final String LEASE_RENEWAL_INTERVAL_IN_SECONDS
Key for lease info representing renewal interval in seconds.- See Also:
- Constant Field Values
-
MAX_AWAIT_REGISTRATION_CONFIRMATION_TRIES
public static final int MAX_AWAIT_REGISTRATION_CONFIRMATION_TRIES
Maximum number of attempts we will make to await confirmation that we're registered with Eureka.- See Also:
- Constant Field Values
-
MAX_REGISTRATION_ATTEMPTS
public static final int MAX_REGISTRATION_ATTEMPTS
Maximum number of attempts we will make trying to register with Eureka (via POST)- See Also:
- Constant Field Values
-
-
Constructor Detail
-
EurekaRegistryService
public EurekaRegistryService(EurekaRegistrationConfig config, EurekaRestClient client, org.kiwiproject.base.KiwiEnvironment environment)
-
EurekaRegistryService
public EurekaRegistryService(EurekaRegistrationConfig config, EurekaRestClient client, org.kiwiproject.base.KiwiEnvironment environment, org.kiwiproject.retry.SimpleRetryer registerRetryer, org.kiwiproject.retry.SimpleRetryer awaitRetryer, org.kiwiproject.retry.SimpleRetryer updateStatusRetryer, org.kiwiproject.retry.SimpleRetryer unregisterRetryer)
-
-
Method Detail
-
createCandidateFrom
public ServiceInstance createCandidateFrom(ServiceInfo serviceInfo)
Description copied from interface:RegistryService
Creates a newServiceInstance
instance from aServiceInfo
that can be registered with the registry server.- Specified by:
createCandidateFrom
in interfaceRegistryService
- Parameters:
serviceInfo
- Service information that will be used to set up a new instance to be registered.- Returns:
- The
ServiceInstance
object that was created
-
register
public ServiceInstance register(ServiceInstance serviceToRegister)
Description copied from interface:RegistryService
Registers aServiceInstance
with the registry server and returns a new instance containing information about the registered instance.- Specified by:
register
in interfaceRegistryService
- Parameters:
serviceToRegister
- The service information to register- Returns:
- The service instance that was registered
-
updateStatus
public ServiceInstance updateStatus(ServiceInstance.Status newStatus)
Description copied from interface:RegistryService
Sends an update to the registry server to inform of a service status change- Specified by:
updateStatus
in interfaceRegistryService
- Parameters:
newStatus
- The new status that will be sent- Returns:
- a copy of the original
ServiceInstance
with the new status set
-
unregister
public void unregister()
Description copied from interface:RegistryService
Unregisters any registrations that were previously registered. This should be a NO-OP if nothing has ever been registered.- Specified by:
unregister
in interfaceRegistryService
-
-