Skip to content

Commit bcb124b

Browse files
authored
4.x: Introduces a Eureka-backed Discovery implementation (helidon-io#10554)
* Introduces a Eureka-backed Discovery implementation Signed-off-by: Laird Nelson <laird.nelson@oracle.com> * Squashable commit; incorporating PR feedback Signed-off-by: Laird Nelson <laird.nelson@oracle.com> --------- Signed-off-by: Laird Nelson <laird.nelson@oracle.com>
1 parent 569f31d commit bcb124b

30 files changed

Lines changed: 3755 additions & 0 deletions

all/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,6 +1281,10 @@
12811281
<groupId>io.helidon.discovery</groupId>
12821282
<artifactId>helidon-discovery</artifactId>
12831283
</dependency>
1284+
<dependency>
1285+
<groupId>io.helidon.discovery.providers</groupId>
1286+
<artifactId>helidon-discovery-providers-eureka</artifactId>
1287+
</dependency>
12841288
</dependencies>
12851289

12861290
</project>

bom/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1697,6 +1697,11 @@
16971697
<artifactId>helidon-discovery</artifactId>
16981698
<version>${helidon.version}</version>
16991699
</dependency>
1700+
<dependency>
1701+
<groupId>io.helidon.discovery.providers</groupId>
1702+
<artifactId>helidon-discovery-providers-eureka</artifactId>
1703+
<version>${helidon.version}</version>
1704+
</dependency>
17001705

17011706
<!-- Metadata -->
17021707
<dependency>

discovery/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
<modules>
3535
<module>discovery</module>
36+
<module>providers</module>
3637
</modules>
3738

3839
</project>

discovery/providers/eureka/pom.xml

Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
4+
Copyright (c) 2017, 2025 Oracle and/or its affiliates.
5+
6+
Licensed under the Apache License, Version 2.0 (the "License");
7+
you may not use this file except in compliance with the License.
8+
You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
18+
-->
19+
20+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
21+
xmlns="http://maven.apache.org/POM/4.0.0"
22+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
23+
<modelVersion>4.0.0</modelVersion>
24+
<parent>
25+
<groupId>io.helidon.discovery.providers</groupId>
26+
<artifactId>helidon-discovery-providers-project</artifactId>
27+
<version>4.3.0-SNAPSHOT</version>
28+
</parent>
29+
<artifactId>helidon-discovery-providers-eureka</artifactId>
30+
<name>Helidon Discovery Providers Eureka</name>
31+
32+
<description>
33+
Eureka-based Discovery provider
34+
</description>
35+
36+
<properties>
37+
<java.util.logging.config.file>src/test/java/logging.properties</java.util.logging.config.file>
38+
</properties>
39+
40+
<dependencies>
41+
42+
<!-- Compile-scoped dependencies. -->
43+
44+
<dependency>
45+
<groupId>io.helidon.builder</groupId>
46+
<artifactId>helidon-builder-api</artifactId>
47+
</dependency>
48+
49+
<dependency>
50+
<groupId>io.helidon.common</groupId>
51+
<artifactId>helidon-common</artifactId>
52+
</dependency>
53+
54+
<dependency>
55+
<groupId>io.helidon.common</groupId>
56+
<artifactId>helidon-common-config</artifactId>
57+
</dependency>
58+
59+
<dependency>
60+
<groupId>io.helidon.common</groupId>
61+
<artifactId>helidon-common-media-type</artifactId>
62+
</dependency>
63+
64+
<dependency>
65+
<groupId>io.helidon.discovery</groupId>
66+
<artifactId>helidon-discovery</artifactId>
67+
</dependency>
68+
69+
<dependency>
70+
<groupId>io.helidon.http</groupId>
71+
<artifactId>helidon-http</artifactId>
72+
</dependency>
73+
74+
<dependency>
75+
<groupId>io.helidon.service</groupId>
76+
<artifactId>helidon-service-registry</artifactId>
77+
</dependency>
78+
79+
<dependency>
80+
<groupId>io.helidon.webclient</groupId>
81+
<artifactId>helidon-webclient-api</artifactId>
82+
</dependency>
83+
84+
<dependency>
85+
<groupId>io.helidon.webclient</groupId>
86+
<artifactId>helidon-webclient-http1</artifactId>
87+
</dependency>
88+
89+
<dependency>
90+
<groupId>jakarta.json</groupId>
91+
<artifactId>jakarta.json-api</artifactId>
92+
</dependency>
93+
94+
<!-- Runtime-scoped dependencies. -->
95+
96+
<dependency>
97+
<groupId>io.helidon.http.encoding</groupId>
98+
<artifactId>helidon-http-encoding-gzip</artifactId>
99+
<scope>runtime</scope>
100+
</dependency>
101+
102+
<dependency>
103+
<groupId>io.helidon.http.media</groupId>
104+
<artifactId>helidon-http-media-jsonp</artifactId>
105+
<scope>runtime</scope>
106+
</dependency>
107+
108+
<!-- Test-scoped dependencies. -->
109+
110+
<dependency>
111+
<groupId>io.helidon.config</groupId>
112+
<artifactId>helidon-config</artifactId>
113+
<scope>test</scope>
114+
</dependency>
115+
116+
<dependency>
117+
<groupId>io.helidon.config</groupId>
118+
<artifactId>helidon-config-yaml</artifactId>
119+
<scope>test</scope>
120+
</dependency>
121+
122+
<dependency>
123+
<groupId>org.junit.jupiter</groupId>
124+
<artifactId>junit-jupiter-api</artifactId>
125+
<scope>test</scope>
126+
</dependency>
127+
128+
<dependency>
129+
<groupId>org.hamcrest</groupId>
130+
<artifactId>hamcrest-core</artifactId>
131+
<scope>test</scope>
132+
</dependency>
133+
134+
</dependencies>
135+
136+
<build>
137+
<plugins>
138+
<plugin>
139+
<artifactId>maven-compiler-plugin</artifactId>
140+
<configuration>
141+
<annotationProcessorPaths>
142+
<path>
143+
<groupId>io.helidon.builder</groupId>
144+
<artifactId>helidon-builder-codegen</artifactId>
145+
<version>${helidon.version}</version>
146+
</path>
147+
<path>
148+
<groupId>io.helidon.codegen</groupId>
149+
<artifactId>helidon-codegen-apt</artifactId>
150+
<version>${helidon.version}</version>
151+
</path>
152+
<path>
153+
<groupId>io.helidon.codegen</groupId>
154+
<artifactId>helidon-codegen-helidon-copyright</artifactId>
155+
<version>${helidon.version}</version>
156+
</path>
157+
<path>
158+
<groupId>io.helidon.config.metadata</groupId>
159+
<artifactId>helidon-config-metadata-codegen</artifactId>
160+
<version>${helidon.version}</version>
161+
</path>
162+
<path>
163+
<groupId>io.helidon.service</groupId>
164+
<artifactId>helidon-service-codegen</artifactId>
165+
<version>${helidon.version}</version>
166+
</path>
167+
</annotationProcessorPaths>
168+
</configuration>
169+
</plugin>
170+
<plugin>
171+
<artifactId>maven-surefire-plugin</artifactId>
172+
<configuration>
173+
<systemPropertyVariables>
174+
<java.util.logging.config.file>${java.util.logging.config.file}</java.util.logging.config.file>
175+
</systemPropertyVariables>
176+
</configuration>
177+
</plugin>
178+
</plugins>
179+
</build>
180+
</project>
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
/*
2+
* Copyright (c) 2025 Oracle and/or its affiliates.
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+
* http://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+
package io.helidon.discovery.providers.eureka;
17+
18+
import java.time.Duration;
19+
20+
import io.helidon.builder.api.Option;
21+
import io.helidon.builder.api.Prototype;
22+
import io.helidon.builder.api.Prototype.Blueprint;
23+
24+
/**
25+
* Prototypical state for the portion of Eureka Discovery configuration related to a local cache of Eureka server
26+
* information.
27+
*/
28+
@Blueprint
29+
@Prototype.Configured
30+
interface CacheConfigBlueprint {
31+
32+
/**
33+
* Whether the state of the cache should be computed from changes reported by Eureka, or replaced in full; {@code true} by default.
34+
*
35+
* @return whether the state of the cache should be computed
36+
*/
37+
@Option.Configured("compute-changes")
38+
@Option.DefaultBoolean(true)
39+
boolean computeChanges();
40+
41+
/**
42+
* Whether to defer immediate cache synchronization; {@code false} by default.
43+
*
44+
* @return {@code true} if cache synchronization should be deferred until it is actually needed
45+
*/
46+
@Option.Configured("defer-sync")
47+
@Option.DefaultBoolean(false)
48+
boolean deferSync();
49+
50+
/**
51+
* Whether a local cache of Eureka information is used or not; {@code true} by default.
52+
*
53+
* @return {@code true} if the cache should be used
54+
*/
55+
@Option.Configured("enabled")
56+
@Option.DefaultBoolean(true)
57+
boolean enabled();
58+
59+
/**
60+
* The name of the {@link Thread} used to retrieve service information from the Eureka server; "Eureka registry
61+
* fetch thread" by default.
62+
*
63+
* @return the name of the {@link Thread} used to retrieve service information from the Eureka server
64+
*
65+
* @see Thread.Builder#name(String)
66+
*/
67+
@Option.Configured("fetch-thread-name")
68+
@Option.Default("Eureka registry fetch thread")
69+
String fetchThreadName();
70+
71+
/**
72+
* The time between retrievals of service information from the Eureka server; 30 seconds by default.
73+
*
74+
* @return the time between retrievals of service information from the Eureka server
75+
*
76+
* @see Duration#parse(CharSequence)
77+
*/
78+
@Option.Configured("sync-interval")
79+
@Option.Default("PT30S")
80+
Duration syncInterval();
81+
82+
}

0 commit comments

Comments
 (0)