Class EurekaUpdatingListenerBuilder
java.lang.Object
com.linecorp.armeria.client.AbstractClientOptionsBuilder
com.linecorp.armeria.client.AbstractWebClientBuilder
com.linecorp.armeria.server.eureka.EurekaUpdatingListenerBuilder
Builds a
EurekaUpdatingListener
, which registers the server to Eureka.
Examples
EurekaUpdatingListener listener =
EurekaUpdatingListener.builder("eureka.com:8001/eureka/v2")
.instanceId("i-00000000")
.setHostname("armeria.service.1")
.ipAddr("192.168.10.10")
.vipAddress("armeria.service.com:8080");
.build();
ServerBuilder sb = Server.builder();
sb.serverListener(listener);
-
Method Summary
Modifier and TypeMethodDescriptionaddHeader(CharSequence name, Object value)
Adds the specified HTTP header.addHeaders(Iterable<? extends Map.Entry<? extends CharSequence,?>> headers)
Adds the specified HTTP headers.appGroupName(String appGroupName)
Sets the group name of the application.Sets the name of the application.auth(BasicToken token)
Sets the HTTP basic access authentication header usingHttpHeaderNames.AUTHORIZATION
.auth(OAuth1aToken token)
Sets the OAuth Core 1.0 Revision A header usingHttpHeaderNames.AUTHORIZATION
.auth(OAuth2Token token)
Sets the OAuth 2.0 header usingHttpHeaderNames.AUTHORIZATION
.build()
Returns a newly-createdEurekaUpdatingListener
based on the properties of this builder.Clears all HTTP-level and RPC-level decorators set so far.dataCenterMetadata(Map<String,String> dataCenterMetadata)
Sets the metadata of the data center.dataCenterName(String dataCenterName)
Sets the name of the data center.decorator(DecoratingHttpClientFunction decorator)
Adds the specified HTTP-leveldecorator
.decorator(Function<? super HttpClient,? extends HttpClient> decorator)
Adds the specified HTTP-leveldecorator
.endpointRemapper(Function<? super Endpoint,? extends EndpointGroup> endpointRemapper)
factory(ClientFactory factory)
Sets theClientFactory
used for creating a client.healthCheckUrl(String healthCheckUrl)
Sets the health check URL.homePageUrl(String homePageUrl)
Sets the home page URL.Sets the hostname.instanceId(String instanceId)
Sets the ID of this instance.Sets the IP address.leaseDuration(Duration leaseDuration)
Sets the lease duration.leaseDurationMillis(long leaseDurationMillis)
Sets the lease duration in milliseconds.leaseDurationSeconds(int leaseDurationSeconds)
Deprecated.maxResponseLength(long maxResponseLength)
Sets the maximum allowed length of a server response in bytes.Sets the metadata.option(ClientOption<T> option, T value)
Adds the specifiedClientOption
and itsvalue
.option(ClientOptionValue<T> optionValue)
Adds the specifiedClientOptionValue
.options(ClientOptions options)
Adds the specifiedClientOptions
.options(ClientOptionValue<?>... options)
Adds the specifiedClientOptionValue
s.options(Iterable<ClientOptionValue<?>> options)
Adds the specifiedClientOptionValue
s.port(int port)
Sets the port used forSessionProtocol.HTTP
.renewalInterval(Duration renewalInterval)
Sets the interval between renewal.renewalIntervalMillis(long renewalIntervalMillis)
Sets the interval between renewal in milliseconds.renewalIntervalSeconds(int renewalIntervalSeconds)
Deprecated.requestIdGenerator(Supplier<RequestId> requestIdGenerator)
responseTimeout(Duration responseTimeout)
Sets the timeout of a response.responseTimeoutMillis(long responseTimeoutMillis)
Sets the timeout of a response in milliseconds.rpcDecorator(DecoratingRpcClientFunction decorator)
Raises anUnsupportedOperationException
because this builder doesn't support RPC-level but only HTTP-level decorators.rpcDecorator(Function<? super RpcClient,? extends RpcClient> decorator)
Raises anUnsupportedOperationException
because this builder doesn't support RPC-level but only HTTP-level decorators.secureHealthCheckUrl(String secureHealthCheckUrl)
Sets the secure health check URL.securePort(int securePort)
Sets the port used forSessionProtocol.HTTPS
.secureVipAddress(String secureVipAddress)
Sets the secure VIP address.setHeader(CharSequence name, Object value)
Sets the specified HTTP header.setHeaders(Iterable<? extends Map.Entry<? extends CharSequence,?>> headers)
Sets the specified HTTP headers.statusPageUrl(String statusPageUrl)
Sets the status page URL.vipAddress(String vipAddress)
Sets the VIP address.writeTimeout(Duration writeTimeout)
Sets the timeout of a socket write attempt.writeTimeoutMillis(long writeTimeoutMillis)
Sets the timeout of a socket write attempt in milliseconds.Methods inherited from class com.linecorp.armeria.client.AbstractWebClientBuilder
buildWebClient, clientBuilderParams
Methods inherited from class com.linecorp.armeria.client.AbstractClientOptionsBuilder
buildOptions, buildOptions, followRedirects, followRedirects
-
Method Details
-
renewalInterval
Sets the interval between renewal. 30 seconds is used by default and it's not recommended to modify this value. Eureka protocol stores this value in seconds internally, and thus this method will convert the given interval into seconds, rounding up its sub-second part. See renew. -
renewalIntervalSeconds
@Deprecated public EurekaUpdatingListenerBuilder renewalIntervalSeconds(int renewalIntervalSeconds)Deprecated.Sets the interval between renewal in seconds. 30 is used by default and it's not recommended to modify this value. See renew. -
renewalIntervalMillis
Sets the interval between renewal in milliseconds.30000
(30 seconds) is used by default and it's not recommended to modify this value. Eureka protocol stores this value in seconds internally, and thus this method will convert the given interval into seconds, rounding up its sub-second part. See renew. -
leaseDuration
Sets the lease duration. 90 seconds is used by default and it's not recommended to modify this value. Eureka protocol stores this value in seconds internally, and thus this method will convert the given duration into seconds, rounding up its sub-second part. See renew. -
leaseDurationSeconds
Deprecated.Sets the lease duration in seconds. 90 is used by default and it's not recommended to modify this value. See renew. -
leaseDurationMillis
Sets the lease duration in milliseconds.90000
(90 seconds) is used by default and it's not recommended to modify this value. Eureka protocol stores this value in seconds internally, and thus this method will convert the given duration into seconds, rounding up its sub-second part. See renew. -
hostname
Sets the hostname.Server.defaultHostname()
is set if not specified. -
instanceId
Sets the ID of this instance.hostname(String)
is set if not specified. -
appName
Sets the name of the application.hostname(String)
is set if not specified. -
appGroupName
Sets the group name of the application. -
ipAddr
Sets the IP address.SystemInfo.defaultNonLoopbackIpV4Address()
is set if not specified. -
port
Sets the port used forSessionProtocol.HTTP
. -
securePort
Sets the port used forSessionProtocol.HTTPS
. -
vipAddress
Sets the VIP address.hostname(String)
is set if not specified. -
secureVipAddress
Sets the secure VIP address.hostname(String)
is set if not specified. -
homePageUrl
Sets the home page URL. -
statusPageUrl
Sets the status page URL. -
healthCheckUrl
Sets the health check URL. IfHealthCheckService
is added toServerBuilder
and Server.activePort(SessionProtocol.HTTP) returns an active port, then this URL will be automatically create using the information of theHealthCheckService
. -
secureHealthCheckUrl
Sets the secure health check URL. IfHealthCheckService
is added toServerBuilder
and Server.activePort(SessionProtocol.HTTPS) returns an active port, then this URL will be automatically create using the information of theHealthCheckService
. -
metadata
Sets the metadata. -
dataCenterName
Sets the name of the data center. -
dataCenterMetadata
Sets the metadata of the data center. -
build
Returns a newly-createdEurekaUpdatingListener
based on the properties of this builder. Note that ifRetryingClient
was not set usingdecorator(DecoratingHttpClientFunction)
,RetryingClient
is applied automatically using RetryingClient.newDecorator(RetryRule.failsafe(), 3). -
options
Description copied from class:AbstractClientOptionsBuilder
Adds the specifiedClientOptions
.- Overrides:
options
in classAbstractClientOptionsBuilder
-
options
Description copied from class:AbstractClientOptionsBuilder
Adds the specifiedClientOptionValue
s.- Overrides:
options
in classAbstractClientOptionsBuilder
-
options
Description copied from class:AbstractClientOptionsBuilder
Adds the specifiedClientOptionValue
s.- Overrides:
options
in classAbstractClientOptionsBuilder
-
option
Description copied from class:AbstractClientOptionsBuilder
Adds the specifiedClientOption
and itsvalue
.- Overrides:
option
in classAbstractClientOptionsBuilder
-
option
Description copied from class:AbstractClientOptionsBuilder
Adds the specifiedClientOptionValue
.- Overrides:
option
in classAbstractClientOptionsBuilder
-
factory
Description copied from class:AbstractClientOptionsBuilder
Sets theClientFactory
used for creating a client. The default isClientFactory.ofDefault()
.- Overrides:
factory
in classAbstractClientOptionsBuilder
-
writeTimeout
Description copied from class:AbstractClientOptionsBuilder
Sets the timeout of a socket write attempt.- Overrides:
writeTimeout
in classAbstractClientOptionsBuilder
- Parameters:
writeTimeout
- the timeout.0
disables the timeout.
-
writeTimeoutMillis
Description copied from class:AbstractClientOptionsBuilder
Sets the timeout of a socket write attempt in milliseconds.- Overrides:
writeTimeoutMillis
in classAbstractClientOptionsBuilder
- Parameters:
writeTimeoutMillis
- the timeout in milliseconds.0
disables the timeout.
-
responseTimeout
Description copied from class:AbstractClientOptionsBuilder
Sets the timeout of a response.- Overrides:
responseTimeout
in classAbstractClientOptionsBuilder
- Parameters:
responseTimeout
- the timeout.0
disables the timeout.
-
responseTimeoutMillis
Description copied from class:AbstractClientOptionsBuilder
Sets the timeout of a response in milliseconds.- Overrides:
responseTimeoutMillis
in classAbstractClientOptionsBuilder
- Parameters:
responseTimeoutMillis
- the timeout in milliseconds.0
disables the timeout.
-
maxResponseLength
Description copied from class:AbstractClientOptionsBuilder
Sets the maximum allowed length of a server response in bytes.- Overrides:
maxResponseLength
in classAbstractClientOptionsBuilder
- Parameters:
maxResponseLength
- the maximum length in bytes.0
disables the limit.
-
requestIdGenerator
Description copied from class:AbstractClientOptionsBuilder
- Overrides:
requestIdGenerator
in classAbstractClientOptionsBuilder
-
endpointRemapper
public EurekaUpdatingListenerBuilder endpointRemapper(Function<? super Endpoint,? extends EndpointGroup> endpointRemapper)Description copied from class:AbstractClientOptionsBuilder
Sets aFunction
that remaps anEndpoint
into anEndpointGroup
. ThisClientOption
is useful when you need to override a single target host into a group of hosts to enable client-side load-balancing, e.g.MyService.Iface client = Clients.newClient("tbinary+http://example.com/api", MyService.Iface.class); EndpointGroup myGroup = EndpointGroup.of(Endpoint.of("node-1.example.com")), Endpoint.of("node-2.example.com"))); MyService.Iface derivedClient = Clients.newDerivedClient(client, options -> { return options.toBuilder() .endpointRemapper(endpoint -> { if (endpoint.host().equals("example.com")) { return myGroup; } else { return endpoint; } }) .build(); }); // This request goes to 'node-1.example.com' or 'node-2.example.com'. derivedClient.call();
Note that the remapping does not occur recursively but only once.
- Overrides:
endpointRemapper
in classAbstractClientOptionsBuilder
- See Also:
ClientOptions.ENDPOINT_REMAPPER
,ClientOptions.endpointRemapper()
-
decorator
public EurekaUpdatingListenerBuilder decorator(Function<? super HttpClient,? extends HttpClient> decorator)Description copied from class:AbstractClientOptionsBuilder
Adds the specified HTTP-leveldecorator
.- Overrides:
decorator
in classAbstractClientOptionsBuilder
- Parameters:
decorator
- theFunction
that transforms anHttpClient
to another
-
decorator
Description copied from class:AbstractClientOptionsBuilder
Adds the specified HTTP-leveldecorator
.- Overrides:
decorator
in classAbstractClientOptionsBuilder
- Parameters:
decorator
- theDecoratingHttpClientFunction
that intercepts an invocation
-
rpcDecorator
public EurekaUpdatingListenerBuilder rpcDecorator(Function<? super RpcClient,? extends RpcClient> decorator)Description copied from class:AbstractWebClientBuilder
Raises anUnsupportedOperationException
because this builder doesn't support RPC-level but only HTTP-level decorators.- Overrides:
rpcDecorator
in classAbstractWebClientBuilder
- Parameters:
decorator
- theFunction
that transforms anRpcClient
to another
-
rpcDecorator
Description copied from class:AbstractWebClientBuilder
Raises anUnsupportedOperationException
because this builder doesn't support RPC-level but only HTTP-level decorators.- Overrides:
rpcDecorator
in classAbstractWebClientBuilder
- Parameters:
decorator
- theDecoratingRpcClientFunction
that intercepts an invocation
-
clearDecorators
Description copied from class:AbstractClientOptionsBuilder
Clears all HTTP-level and RPC-level decorators set so far.- Overrides:
clearDecorators
in classAbstractClientOptionsBuilder
-
addHeader
Description copied from class:AbstractClientOptionsBuilder
Adds the specified HTTP header.- Overrides:
addHeader
in classAbstractClientOptionsBuilder
-
addHeaders
public EurekaUpdatingListenerBuilder addHeaders(Iterable<? extends Map.Entry<? extends CharSequence,?>> headers)Description copied from class:AbstractClientOptionsBuilder
Adds the specified HTTP headers.- Overrides:
addHeaders
in classAbstractClientOptionsBuilder
-
setHeader
Description copied from class:AbstractClientOptionsBuilder
Sets the specified HTTP header.- Overrides:
setHeader
in classAbstractClientOptionsBuilder
-
setHeaders
public EurekaUpdatingListenerBuilder setHeaders(Iterable<? extends Map.Entry<? extends CharSequence,?>> headers)Description copied from class:AbstractClientOptionsBuilder
Sets the specified HTTP headers.- Overrides:
setHeaders
in classAbstractClientOptionsBuilder
-
auth
Description copied from class:AbstractClientOptionsBuilder
Sets the HTTP basic access authentication header usingHttpHeaderNames.AUTHORIZATION
.- Overrides:
auth
in classAbstractClientOptionsBuilder
-
auth
Description copied from class:AbstractClientOptionsBuilder
Sets the OAuth Core 1.0 Revision A header usingHttpHeaderNames.AUTHORIZATION
.- Overrides:
auth
in classAbstractClientOptionsBuilder
-
auth
Description copied from class:AbstractClientOptionsBuilder
Sets the OAuth 2.0 header usingHttpHeaderNames.AUTHORIZATION
.- Overrides:
auth
in classAbstractClientOptionsBuilder
-
leaseDurationMillis(long)
.