diff --git a/bom/application/pom.xml b/bom/application/pom.xml index b852e7c784e64..bd29ab522efbf 100644 --- a/bom/application/pom.xml +++ b/bom/application/pom.xml @@ -64,7 +64,7 @@ 3.0.1 3.15.0 4.24.0 - 2.6.1 + 2.7.0 2.1.3 3.0.0 3.0.0 diff --git a/extensions/smallrye-stork/runtime/src/main/java/io/quarkus/stork/ServiceConfiguration.java b/extensions/smallrye-stork/runtime/src/main/java/io/quarkus/stork/ServiceConfiguration.java index 7ef7b23f3f9ef..c8e4adb66ff2b 100644 --- a/extensions/smallrye-stork/runtime/src/main/java/io/quarkus/stork/ServiceConfiguration.java +++ b/extensions/smallrye-stork/runtime/src/main/java/io/quarkus/stork/ServiceConfiguration.java @@ -9,7 +9,7 @@ public interface ServiceConfiguration { /** * ServiceDiscovery configuration for the service */ - StorkServiceDiscoveryConfiguration serviceDiscovery(); + Optional serviceDiscovery(); /** * LoadBalancer configuration for the service diff --git a/extensions/smallrye-stork/runtime/src/main/java/io/quarkus/stork/StorkConfigUtil.java b/extensions/smallrye-stork/runtime/src/main/java/io/quarkus/stork/StorkConfigUtil.java index 17671e5a88d51..f1d9c304235fd 100644 --- a/extensions/smallrye-stork/runtime/src/main/java/io/quarkus/stork/StorkConfigUtil.java +++ b/extensions/smallrye-stork/runtime/src/main/java/io/quarkus/stork/StorkConfigUtil.java @@ -16,12 +16,15 @@ public static List toStorkServiceConfig(StorkConfiguration storkC for (String serviceName : servicesConfigs) { builder.setServiceName(serviceName); ServiceConfiguration serviceConfiguration = storkConfiguration.serviceConfiguration().get(serviceName); - SimpleServiceConfig.SimpleServiceDiscoveryConfig storkServiceDiscoveryConfig = new SimpleServiceConfig.SimpleServiceDiscoveryConfig( - serviceConfiguration.serviceDiscovery().type(), serviceConfiguration.serviceDiscovery().params()); - builder = builder.setServiceDiscovery(storkServiceDiscoveryConfig); - SimpleServiceConfig.SimpleLoadBalancerConfig loadBalancerConfig = new SimpleServiceConfig.SimpleLoadBalancerConfig( - serviceConfiguration.loadBalancer().type(), serviceConfiguration.loadBalancer().parameters()); - builder.setLoadBalancer(loadBalancerConfig); + if (serviceConfiguration.serviceDiscovery().isPresent()) { + SimpleServiceConfig.SimpleServiceDiscoveryConfig storkServiceDiscoveryConfig = new SimpleServiceConfig.SimpleServiceDiscoveryConfig( + serviceConfiguration.serviceDiscovery().get().type(), + serviceConfiguration.serviceDiscovery().get().params()); + builder = builder.setServiceDiscovery(storkServiceDiscoveryConfig); + SimpleServiceConfig.SimpleLoadBalancerConfig loadBalancerConfig = new SimpleServiceConfig.SimpleLoadBalancerConfig( + serviceConfiguration.loadBalancer().type(), serviceConfiguration.loadBalancer().parameters()); + builder.setLoadBalancer(loadBalancerConfig); + } if (serviceConfiguration.serviceRegistrar().isPresent()) { SimpleServiceConfig.SimpleServiceRegistrarConfig serviceRegistrarConfig = new SimpleServiceConfig.SimpleServiceRegistrarConfig( serviceConfiguration.serviceRegistrar().get().type(), diff --git a/independent-projects/resteasy-reactive/pom.xml b/independent-projects/resteasy-reactive/pom.xml index 847e2b08e1f96..a2fae4c8cb6a7 100644 --- a/independent-projects/resteasy-reactive/pom.xml +++ b/independent-projects/resteasy-reactive/pom.xml @@ -62,7 +62,7 @@ 5.5.0 1.0.0.Final 2.17.2 - 2.6.1 + 2.7.0 3.0.2 3.0.4 3.0.1 diff --git a/integration-tests/smallrye-stork-registration/pom.xml b/integration-tests/smallrye-stork-registration/pom.xml index 3986cd800e0d0..7e5f1ddf33ae3 100644 --- a/integration-tests/smallrye-stork-registration/pom.xml +++ b/integration-tests/smallrye-stork-registration/pom.xml @@ -17,18 +17,13 @@ io.quarkus quarkus-vertx-http - - - io.quarkus - quarkus-rest-client-jackson - io.quarkus - quarkus-rest-jackson + quarkus-smallrye-stork-deployment io.smallrye.stork - stork-service-discovery-static-list + stork-service-registration-static-list @@ -52,32 +47,6 @@ - - io.quarkus - quarkus-rest-jackson-deployment - ${project.version} - pom - test - - - * - * - - - - - io.quarkus - quarkus-rest-client-jackson-deployment - ${project.version} - pom - test - - - * - * - - - io.quarkus quarkus-vertx-http-deployment diff --git a/integration-tests/smallrye-stork-registration/src/main/java/org/acme/ClientCallingResource.java b/integration-tests/smallrye-stork-registration/src/main/java/org/acme/ClientCallingResource.java deleted file mode 100644 index 46110519ad351..0000000000000 --- a/integration-tests/smallrye-stork-registration/src/main/java/org/acme/ClientCallingResource.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.acme; - -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.core.MediaType; - -import org.eclipse.microprofile.rest.client.inject.RestClient; - -/** - * A frontend API using our REST Client (which uses Stork to locate and select the service instance on each call). - */ -@Path("/api") -public class ClientCallingResource { - - @RestClient - MyServiceClient service; - - @GET - @Produces(MediaType.TEXT_PLAIN) - public String invoke() { - return service.get(); - } - -} diff --git a/integration-tests/smallrye-stork-registration/src/main/java/org/acme/MyServiceClient.java b/integration-tests/smallrye-stork-registration/src/main/java/org/acme/MyServiceClient.java deleted file mode 100644 index aeba6019125d3..0000000000000 --- a/integration-tests/smallrye-stork-registration/src/main/java/org/acme/MyServiceClient.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.acme; - -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.core.MediaType; - -import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; - -/** - * The REST Client interface. - * - * Notice the `baseUri`. It uses `stork://` as URL scheme indicating that the called service uses Stork to locate and - * select the service instance. The `my-service` part is the service name. This is used to configure Stork discovery - * and selection in the `application.properties` file. - */ -@RegisterRestClient(baseUri = "stork://my-service") -public interface MyServiceClient { - - @GET - @Produces(MediaType.TEXT_PLAIN) - String get(); -} diff --git a/integration-tests/smallrye-stork-registration/src/main/java/org/acme/services/BlueService.java b/integration-tests/smallrye-stork-registration/src/main/java/org/acme/services/BlueService.java deleted file mode 100644 index f209e90dfd910..0000000000000 --- a/integration-tests/smallrye-stork-registration/src/main/java/org/acme/services/BlueService.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.acme.services; - -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.enterprise.event.Observes; - -import org.eclipse.microprofile.config.inject.ConfigProperty; - -import io.quarkus.runtime.StartupEvent; -import io.vertx.mutiny.core.Vertx; - -@ApplicationScoped -public class BlueService { - - @ConfigProperty(name = "blue-service-port", defaultValue = "9000") - int port; - - /** - * Start an HTTP server for the blue service. - * - * Note: this method is called on a worker thread, and so it is allowed to block. - */ - public void init(@Observes StartupEvent ev, Vertx vertx) { - vertx.createHttpServer() - .requestHandler(req -> req.response().endAndForget("Hello from Blue!")) - .listenAndAwait(port); - } -} diff --git a/integration-tests/smallrye-stork-registration/src/main/java/org/acme/services/RedService.java b/integration-tests/smallrye-stork-registration/src/main/java/org/acme/services/RedService.java deleted file mode 100644 index 475ca81eaf3a0..0000000000000 --- a/integration-tests/smallrye-stork-registration/src/main/java/org/acme/services/RedService.java +++ /dev/null @@ -1,28 +0,0 @@ - -package org.acme.services; - -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.enterprise.event.Observes; - -import org.eclipse.microprofile.config.inject.ConfigProperty; - -import io.quarkus.runtime.StartupEvent; -import io.vertx.mutiny.core.Vertx; - -@ApplicationScoped -public class RedService { - @ConfigProperty(name = "red-service-port", defaultValue = "9001") - int port; - - /** - * Start an HTTP server for the red service. - * - * Note: this method is called on a worker thread, and so it is allowed to block. - */ - public void init(@Observes StartupEvent ev, Vertx vertx) { - vertx.createHttpServer() - .requestHandler(req -> req.response().endAndForget("Hello from Red!")) - .listenAndAwait(port); - } - -} diff --git a/integration-tests/smallrye-stork-registration/src/main/resources/application.properties b/integration-tests/smallrye-stork-registration/src/main/resources/application.properties index 15a149ec67485..81c4c37bf3d81 100644 --- a/integration-tests/smallrye-stork-registration/src/main/resources/application.properties +++ b/integration-tests/smallrye-stork-registration/src/main/resources/application.properties @@ -1,3 +1 @@ -quarkus.stork.my-service.service-discovery.type=static - quarkus.stork.my-service.service-registrar.type=static diff --git a/integration-tests/smallrye-stork-registration/src/test/java/org/acme/ClientCallingResourceTest.java b/integration-tests/smallrye-stork-registration/src/test/java/org/acme/ClientCallingResourceTest.java index 530da75f8fbb6..c88639c05314e 100644 --- a/integration-tests/smallrye-stork-registration/src/test/java/org/acme/ClientCallingResourceTest.java +++ b/integration-tests/smallrye-stork-registration/src/test/java/org/acme/ClientCallingResourceTest.java @@ -1,24 +1,22 @@ package org.acme; -import java.util.HashSet; -import java.util.Set; +import jakarta.inject.Inject; +import org.acme.services.Registration; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import io.quarkus.test.junit.QuarkusTest; -import io.restassured.RestAssured; @QuarkusTest public class ClientCallingResourceTest { + @Inject + Registration registration; + @Test public void test() { - Set bodies = new HashSet<>(); - for (int i = 0; i < 10; i++) { - bodies.add(RestAssured.get("/api").then().statusCode(200).extract().body().asString()); - } - Assertions.assertEquals(2, bodies.size()); + Assertions.assertNotNull(registration); } }