Package io.micronaut.discovery.consul
Class ConsulConfiguration
java.lang.Object
io.micronaut.http.client.HttpClientConfiguration
io.micronaut.discovery.client.DiscoveryClientConfiguration
io.micronaut.discovery.consul.ConsulConfiguration
@RequiresConsul
@ConfigurationProperties("consul.client")
@Requires(property="consul.client")
public class ConsulConfiguration
extends DiscoveryClientConfiguration
Configuration for consul.
- Since:
- 1.0
- Author:
- graemerocher
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Configuration class for Consul client config.static class
The default connection pool configuration.static class
Configuration class for Consul client discovery.static class
Configuration class for Consul client registration.Nested classes/interfaces inherited from class io.micronaut.http.client.HttpClientConfiguration
io.micronaut.http.client.HttpClientConfiguration.ConnectionPoolConfiguration, io.micronaut.http.client.HttpClientConfiguration.WebSocketCompressionConfiguration
-
Field Summary
Fields inherited from class io.micronaut.http.client.HttpClientConfiguration
DEFAULT_ALLOW_BLOCK_EVENT_LOOP, DEFAULT_CONNECTION_POOL_IDLE_TIMEOUT_SECONDS, DEFAULT_EXCEPTION_ON_ERROR_STATUS, DEFAULT_FOLLOW_REDIRECTS, DEFAULT_MAX_CONTENT_LENGTH, DEFAULT_READ_IDLE_TIMEOUT_MINUTES, DEFAULT_READ_TIMEOUT_SECONDS, DEFAULT_SHUTDOWN_QUIET_PERIOD_MILLISECONDS, DEFAULT_SHUTDOWN_TIMEOUT_MILLISECONDS
-
Constructor Summary
ConstructorDescriptionDefault Consult configuration.ConsulConfiguration
(ConsulConfiguration.ConsulConnectionPoolConfiguration consulConnectionPoolConfiguration, io.micronaut.runtime.ApplicationConfiguration applicationConfiguration) -
Method Summary
Modifier and TypeMethodDescriptionio.micronaut.http.client.HttpClientConfiguration.ConnectionPoolConfiguration
protected String
boolean
void
setAslToken
(String aslToken) void
void
void
setHealthCheck
(boolean healthCheck) Sets whether the Consul server should be considered for health checks.void
toString()
Methods inherited from class io.micronaut.discovery.client.DiscoveryClientConfiguration
getAllZones, getContextPath, getDefaultZone, getHost, getPort, getServiceId, isSecure, isShouldUseDns, setContextPath, setDefaultZone, setHost, setPort, setSecure, setShouldUseDns, setZones
Methods inherited from class io.micronaut.http.client.HttpClientConfiguration
getAlpnModes, getChannelOptions, getConnectionPoolIdleTimeout, getConnectTimeout, getConnectTtl, getDefaultCharset, getEventLoopGroup, getHttpVersion, getLoggerName, getLogLevel, getMaxContentLength, getNumOfThreads, getPlaintextMode, getProxyAddress, getProxyPassword, getProxySelector, getProxyType, getProxyUsername, getReadIdleTimeout, getReadTimeout, getShutdownQuietPeriod, getShutdownTimeout, getSslConfiguration, getThreadFactory, getWebSocketCompressionConfiguration, isAllowBlockEventLoop, isExceptionOnErrorStatus, isFollowRedirects, resolveProxy, setAllowBlockEventLoop, setAlpnModes, setChannelOptions, setConnectionPoolIdleTimeout, setConnectTimeout, setConnectTtl, setDefaultCharset, setEventLoopGroup, setExceptionOnErrorStatus, setFollowRedirects, setHttpVersion, setLoggerName, setLogLevel, setMaxContentLength, setNumOfThreads, setPlaintextMode, setProxyAddress, setProxyPassword, setProxySelector, setProxyType, setProxyUsername, setReadIdleTimeout, setReadTimeout, setShutdownQuietPeriod, setShutdownTimeout, setSslConfiguration, setThreadFactory
-
Field Details
-
PREFIX
The prefix to use for all Consul settings.- See Also:
-
-
Constructor Details
-
ConsulConfiguration
public ConsulConfiguration()Default Consult configuration. -
ConsulConfiguration
@Inject public ConsulConfiguration(ConsulConfiguration.ConsulConnectionPoolConfiguration consulConnectionPoolConfiguration, io.micronaut.runtime.ApplicationConfiguration applicationConfiguration) - Parameters:
consulConnectionPoolConfiguration
- The connection pool configurationapplicationConfiguration
- The application configuration
-
-
Method Details
-
isHealthCheck
public boolean isHealthCheck()- Returns:
- Whether the Consul server should be considered for health checks.
- See Also:
-
setHealthCheck
public void setHealthCheck(boolean healthCheck) Sets whether the Consul server should be considered for health checks.- Parameters:
healthCheck
- True if it should- See Also:
-
getConnectionPoolConfiguration
public io.micronaut.http.client.HttpClientConfiguration.ConnectionPoolConfiguration getConnectionPoolConfiguration()- Specified by:
getConnectionPoolConfiguration
in classio.micronaut.http.client.HttpClientConfiguration
-
getConfiguration
- Returns:
- The configuration discovery configuration
-
setConfiguration
@Inject public void setConfiguration(ConsulConfiguration.ConsulConfigDiscoveryConfiguration configuration) - Parameters:
configuration
- TheConsulConfiguration.ConsulConfigDiscoveryConfiguration
-
getAslToken
- Returns:
- The token to include in all requests as the
X-Consul-Token
header
-
setAslToken
- Parameters:
aslToken
- The asl token
-
getRegistration
- Specified by:
getRegistration
in classDiscoveryClientConfiguration
- Returns:
- The registration configuration
-
setRegistration
@Inject public void setRegistration(ConsulConfiguration.ConsulRegistrationConfiguration registration) - Parameters:
registration
- TheConsulConfiguration.ConsulRegistrationConfiguration
-
getDiscovery
- Specified by:
getDiscovery
in classDiscoveryClientConfiguration
- Returns:
- The discovery configuration
-
setDiscovery
- Parameters:
discovery
- TheConsulConfiguration.ConsulDiscoveryConfiguration
-
getServiceID
- Specified by:
getServiceID
in classDiscoveryClientConfiguration
- Returns:
- The serviceID
-
toString
- Overrides:
toString
in classDiscoveryClientConfiguration
-