@Singleton @Requires(classes=com.amazonaws.services.servicediscovery.AWSServiceDiscovery.class) @Requires(env="ec2") @Requires(beans=Route53AutoRegistrationConfiguration.class) @Requires(property="aws.route53.registration.enabled",value="true",defaultValue="false") @Requires(property="micronaut.application.name") public class Route53AutoNamingRegistrationClient extends DiscoveryServiceAutoRegistration
DiscoveryServiceAutoRegistration
for Route 53.Modifier and Type | Field and Description |
---|---|
static String |
AWS_ALIAS_DNS_NAME
Constant for AWS alias dns name.
|
static String |
AWS_INSTANCE_CNAME
Constant for AWS instance cname.
|
static String |
AWS_INSTANCE_IPV4
Constant for AWS intance IPv4.
|
static String |
AWS_INSTANCE_IPV6
Constant for AWS instance IPv6.
|
static String |
AWS_INSTANCE_PORT
Constant for AWS instance port.
|
static String |
ENABLED
Constant for whether route 53 registration is enabled.
|
Modifier | Constructor and Description |
---|---|
protected |
Route53AutoNamingRegistrationClient(Environment environment,
Route53AutoRegistrationConfiguration route53AutoRegistrationConfiguration,
io.micronaut.configuration.aws.AWSClientConfiguration clientConfiguration,
AmazonComputeInstanceMetadataResolver amazonComputeInstanceMetadataResolver,
Executor executorService,
AWSServiceDiscoveryResolver awsServiceDiscoveryResolver)
Constructor for setup.
|
Modifier and Type | Method and Description |
---|---|
String |
createNamespace(String name)
This is a helper method for integration tests to create a new namespace.
|
String |
createService(com.amazonaws.services.servicediscovery.AWSServiceDiscovery serviceDiscovery,
String name,
String description,
String namespaceId,
Long ttl)
Create service, helper for integration tests.
|
void |
deleteNamespace(String namespaceId)
these are convenience methods to help cleanup things like integration test data.
|
void |
deleteService(String serviceId)
These are convenience methods to help cleanup things like integration test data.
|
protected void |
deregister(ServiceInstance instance)
shutdown instance if it fails health check can gracefully stop.
|
com.amazonaws.services.servicediscovery.AWSServiceDiscoveryAsync |
getDiscoveryClient()
Gets the discovery client Impl for easier testing.
|
com.amazonaws.services.servicediscovery.model.Service |
getDiscoveryService()
Gets the discovery service used on route53.
|
protected void |
pulsate(ServiceInstance instance,
HealthStatus status)
If custom health check is enabled, this sends a heartbeat to it.
|
protected void |
register(ServiceInstance instance)
register new instance to the service registry.
|
void |
setDiscoveryService(com.amazonaws.services.servicediscovery.model.Service discoveryService)
Used for testing.
|
getErrorMessage, performDeregistration, performRegistration
onApplicationEvent, validateApplicationName, validateName
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
supports
public static final String AWS_INSTANCE_PORT
public static final String AWS_INSTANCE_IPV4
public static final String AWS_INSTANCE_CNAME
public static final String AWS_INSTANCE_IPV6
public static final String AWS_ALIAS_DNS_NAME
public static final String ENABLED
protected Route53AutoNamingRegistrationClient(Environment environment, Route53AutoRegistrationConfiguration route53AutoRegistrationConfiguration, io.micronaut.configuration.aws.AWSClientConfiguration clientConfiguration, AmazonComputeInstanceMetadataResolver amazonComputeInstanceMetadataResolver, @Named(value="io") Executor executorService, AWSServiceDiscoveryResolver awsServiceDiscoveryResolver)
environment
- current environemntsroute53AutoRegistrationConfiguration
- config for auto registrationclientConfiguration
- general client configuraitonamazonComputeInstanceMetadataResolver
- resolver for aws compute metdataexecutorService
- this is for executing the thread to monitor the register operation for completionawsServiceDiscoveryResolver
- this allows is to swap out the bean for a mock version for unit testingprotected void pulsate(ServiceInstance instance, HealthStatus status)
pulsate
in class AutoRegistration
instance
- The instance of the servicestatus
- The HealthStatus
protected void deregister(ServiceInstance instance)
deregister
in class AutoRegistration
instance
- The ServiceInstance
protected void register(ServiceInstance instance)
register
in class AutoRegistration
instance
- The ServiceInstance
public void deleteService(String serviceId)
serviceId
- service id from AWS to deletepublic void deleteNamespace(String namespaceId)
namespaceId
- namespace ID from AWS to deletepublic String createNamespace(String name)
name
- name of the namespace in your route53public String createService(com.amazonaws.services.servicediscovery.AWSServiceDiscovery serviceDiscovery, String name, String description, String namespaceId, Long ttl)
serviceDiscovery
- service discovery instancename
- name of the servicedescription
- description of the servicenamespaceId
- namespaceId to attach it to (get via cli or api call)ttl
- time to live for checking pulsepublic com.amazonaws.services.servicediscovery.AWSServiceDiscoveryAsync getDiscoveryClient()
public com.amazonaws.services.servicediscovery.model.Service getDiscoveryService()
public void setDiscoveryService(com.amazonaws.services.servicediscovery.model.Service discoveryService)
discoveryService
- service reference on route53 on AWS