19 | <#include "navbar.ftlh">
20 |
21 |
22 |
26 |
27 |
28 |
29 |
30 | | Timestamp | Lease |
31 |
32 |
33 | <#if lastNCanceled?has_content>
34 | <#list lastNCanceled as entry>
35 | | ${entry.date?datetime} | ${entry.id} |
36 | #list>
37 | <#else>
38 | | No results available |
39 | #if>
40 |
41 |
42 |
43 |
44 |
45 |
46 | | Timestamp | Lease |
47 |
48 |
49 | <#if lastNRegistered?has_content>
50 | <#list lastNRegistered as entry>
51 | | ${entry.date?datetime} | ${entry.id} |
52 | #list>
53 | <#else>
54 | | No results available |
55 | #if>
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/loadbalancer/LoadBalancerEurekaAutoConfiguration.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013-present the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.springframework.cloud.netflix.eureka.loadbalancer;
18 |
19 | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
20 | import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
21 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
22 | import org.springframework.boot.context.properties.EnableConfigurationProperties;
23 | import org.springframework.cloud.loadbalancer.annotation.LoadBalancerClientConfigurationRegistrar;
24 | import org.springframework.cloud.loadbalancer.annotation.LoadBalancerClients;
25 | import org.springframework.cloud.loadbalancer.config.LoadBalancerZoneConfig;
26 | import org.springframework.context.annotation.Bean;
27 | import org.springframework.context.annotation.Configuration;
28 | import org.springframework.core.env.Environment;
29 |
30 | /**
31 | * An Autoconfiguration that loads default config for Spring Cloud LoadBalancer clients.
32 | *
33 | * @author Olga Maciaszek-Sharma
34 | * @since 2.2.1
35 | * @see EurekaLoadBalancerClientConfiguration
36 | */
37 | @Configuration(proxyBeanMethods = false)
38 | @EnableConfigurationProperties
39 | @ConditionalOnClass(LoadBalancerClientConfigurationRegistrar.class)
40 | @LoadBalancerClients(defaultConfiguration = EurekaLoadBalancerClientConfiguration.class)
41 | @ConditionalOnProperty(name = "eureka.client.enabled", matchIfMissing = true)
42 | public class LoadBalancerEurekaAutoConfiguration {
43 |
44 | /**
45 | * Spring Cloud LoadBalancer Zone property name.
46 | */
47 | public static final String LOADBALANCER_ZONE = "spring.cloud.loadbalancer.zone";
48 |
49 | @Bean
50 | @ConditionalOnMissingBean
51 | EurekaLoadBalancerProperties eurekaLoadBalancerProperties() {
52 | return new EurekaLoadBalancerProperties();
53 | }
54 |
55 | @Bean
56 | @ConditionalOnMissingBean
57 | LoadBalancerZoneConfig zoneConfig(Environment environment) {
58 | return new LoadBalancerZoneConfig(environment.getProperty(LOADBALANCER_ZONE));
59 | }
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/spring-cloud-netflix-eureka-server/src/main/java/org/springframework/cloud/netflix/eureka/server/InstanceRegistryProperties.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013-present the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.springframework.cloud.netflix.eureka.server;
18 |
19 | import org.springframework.beans.factory.annotation.Value;
20 | import org.springframework.boot.context.properties.ConfigurationProperties;
21 |
22 | import static org.springframework.cloud.netflix.eureka.server.InstanceRegistryProperties.PREFIX;
23 |
24 | /**
25 | * @author Spencer Gibb
26 | */
27 | @ConfigurationProperties(PREFIX)
28 | public class InstanceRegistryProperties {
29 |
30 | /**
31 | * Prefix for Eureka instance registry properties.
32 | */
33 | public static final String PREFIX = "eureka.instance.registry";
34 |
35 | /*
36 | * Default number of expected client, defaults to 1. Setting
37 | * expectedNumberOfClientsSendingRenews to non-zero to ensure that even an isolated
38 | * server can adjust its eviction policy to the number of registrations (when it's
39 | * zero, even a successful registration won't reset the rate threshold in
40 | * InstanceRegistry.register()).
41 | */
42 | @Value("${eureka.server.expectedNumberOfRenewsPerMin:1}") // for backwards
43 | // compatibility
44 | private int expectedNumberOfClientsSendingRenews = 1;
45 |
46 | /**
47 | * Value used in determining when leases are cancelled, default to 1 for standalone.
48 | * Should be set to 0 for peer replicated eurekas
49 | */
50 | @Value("${eureka.server.defaultOpenForTrafficCount:1}") // for backwards compatibility
51 | private int defaultOpenForTrafficCount = 1;
52 |
53 | public int getExpectedNumberOfClientsSendingRenews() {
54 | return expectedNumberOfClientsSendingRenews;
55 | }
56 |
57 | public void setExpectedNumberOfClientsSendingRenews(int expectedNumberOfClientsSendingRenews) {
58 | this.expectedNumberOfClientsSendingRenews = expectedNumberOfClientsSendingRenews;
59 | }
60 |
61 | public int getDefaultOpenForTrafficCount() {
62 | return defaultOpenForTrafficCount;
63 | }
64 |
65 | public void setDefaultOpenForTrafficCount(int defaultOpenForTrafficCount) {
66 | this.defaultOpenForTrafficCount = defaultOpenForTrafficCount;
67 | }
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/reactive/EurekaReactiveDiscoveryClient.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-present the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.springframework.cloud.netflix.eureka.reactive;
18 |
19 | import com.netflix.discovery.EurekaClient;
20 | import com.netflix.discovery.EurekaClientConfig;
21 | import com.netflix.discovery.shared.Application;
22 | import com.netflix.discovery.shared.Applications;
23 | import reactor.core.publisher.Flux;
24 | import reactor.core.publisher.Mono;
25 |
26 | import org.springframework.cloud.client.ServiceInstance;
27 | import org.springframework.cloud.client.discovery.ReactiveDiscoveryClient;
28 | import org.springframework.cloud.netflix.eureka.EurekaServiceInstance;
29 | import org.springframework.core.Ordered;
30 |
31 | /**
32 | * A {@link ReactiveDiscoveryClient} implementation for Eureka.
33 | *
34 | * @author Tim Ysewyn
35 | */
36 | public class EurekaReactiveDiscoveryClient implements ReactiveDiscoveryClient {
37 |
38 | private final EurekaClient eurekaClient;
39 |
40 | private final EurekaClientConfig clientConfig;
41 |
42 | public EurekaReactiveDiscoveryClient(EurekaClient eurekaClient, EurekaClientConfig clientConfig) {
43 | this.eurekaClient = eurekaClient;
44 | this.clientConfig = clientConfig;
45 | }
46 |
47 | @Override
48 | public String description() {
49 | return "Spring Cloud Eureka Reactive Discovery Client";
50 | }
51 |
52 | @Override
53 | public Flux