Skip to content

Commit

Permalink
Merge pull request quarkusio#42161 from aureamunoz/use-latest-stork-r…
Browse files Browse the repository at this point in the history
…egistration

Use Stork registrars in standalone way
  • Loading branch information
cescoffier authored Sep 22, 2024
2 parents 4283b2f + be13dac commit 656dd40
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 154 deletions.
2 changes: 1 addition & 1 deletion bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
<smallrye-reactive-types-converter.version>3.0.1</smallrye-reactive-types-converter.version>
<smallrye-mutiny-vertx-binding.version>3.15.0</smallrye-mutiny-vertx-binding.version>
<smallrye-reactive-messaging.version>4.24.0</smallrye-reactive-messaging.version>
<smallrye-stork.version>2.6.1</smallrye-stork.version>
<smallrye-stork.version>2.7.0</smallrye-stork.version>
<jakarta.activation.version>2.1.3</jakarta.activation.version>
<jakarta.annotation-api.version>3.0.0</jakarta.annotation-api.version>
<jakarta.authentication-api>3.0.0</jakarta.authentication-api>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public interface ServiceConfiguration {
/**
* ServiceDiscovery configuration for the service
*/
StorkServiceDiscoveryConfiguration serviceDiscovery();
Optional<StorkServiceDiscoveryConfiguration> serviceDiscovery();

/**
* LoadBalancer configuration for the service
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@ public static List<ServiceConfig> 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(),
Expand Down
2 changes: 1 addition & 1 deletion independent-projects/resteasy-reactive/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<rest-assured.version>5.5.0</rest-assured.version>
<commons-logging-jboss-logging.version>1.0.0.Final</commons-logging-jboss-logging.version>
<jackson-bom.version>2.17.2</jackson-bom.version>
<smallrye-stork.version>2.6.1</smallrye-stork.version>
<smallrye-stork.version>2.7.0</smallrye-stork.version>
<jakarta.validation-api.version>3.0.2</jakarta.validation-api.version>
<yasson.version>3.0.4</yasson.version>
<jakarta.json.bind-api.version>3.0.1</jakarta.json.bind-api.version>
Expand Down
35 changes: 2 additions & 33 deletions integration-tests/smallrye-stork-registration/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,13 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-vertx-http</artifactId>
</dependency>

<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-rest-client-jackson</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-rest-jackson</artifactId>
<artifactId>quarkus-smallrye-stork-deployment</artifactId>
</dependency>
<dependency>
<groupId>io.smallrye.stork</groupId>
<artifactId>stork-service-discovery-static-list</artifactId>
<artifactId>stork-service-registration-static-list</artifactId>
</dependency>
<!-- Test dependencies -->
<dependency>
Expand All @@ -52,32 +47,6 @@
</dependency>

<!-- Minimal test dependencies to *-deployment artifacts for consistent build order -->
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-rest-jackson-deployment</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-rest-client-jackson-deployment</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-vertx-http-deployment</artifactId>
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
quarkus.stork.my-service.service-discovery.type=static

quarkus.stork.my-service.service-registrar.type=static
Original file line number Diff line number Diff line change
@@ -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<String> 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);
}

}

0 comments on commit 656dd40

Please sign in to comment.