Uploaded image for project: 'Quarkus'
  1. Quarkus
  2. QUARKUS-781

Quarkus MP rest client can't consume /health and /metrics

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Critical Critical
    • None
    • 1.11.0.ER1, 1.11.5.CR2
    • team/eng
    • False
    • False
    • Undefined
    • Hide

      Add  Quarkus Rest client as a dependency:

      <dependency>
          <groupId>io.quarkus</groupId>
          <artifactId>quarkus-rest-client</artifactId>
      </dependency>
      

      Setup a Rest client:

      import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
      
      import javax.ws.rs.GET;
      import javax.ws.rs.Path;
      import javax.ws.rs.core.Response;
      
      @Path("/api")
      @RegisterRestClient
      public interface HealthClientService {
      
          @GET
          @Path("/health")
          Response health();
      }
      

      Properties:

      quarkus.http.root-path=/api
      quarkus.http.port=8081
      
      io.quarkus.ts.openshift.http.HealthClientService/mp-rest/url=http://localhost:8081
      io.quarkus.ts.openshift.http.HealthClientService/mp-rest/scope=javax.inject.Singleton 
      

      And then make a query:

      @Inject
      @RestClient
      private HealthClientService healthClient;
       
      assertThat(200, equalTo(healthClient.health().getStatus()));
      

      You will get an HTTP Status 301. 

       

      Show
      Add  Quarkus Rest client as a dependency: <dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus- rest -client</artifactId> </dependency> Setup a Rest client: import org.eclipse.microprofile. rest .client.inject.RegisterRestClient; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.core.Response; @Path( "/api" ) @RegisterRestClient public interface HealthClientService { @GET @Path( "/health" ) Response health(); } Properties: quarkus.http.root-path=/api quarkus.http.port=8081 io.quarkus.ts.openshift.http.HealthClientService/mp- rest /url=http: //localhost:8081 io.quarkus.ts.openshift.http.HealthClientService/mp- rest /scope=javax.inject.Singleton And then make a query: @Inject @RestClient private HealthClientService healthClient;   assertThat(200, equalTo(healthClient.health().getStatus())); You will get an HTTP Status 301.   
    • ---

      microprofile-rest-client delivered as part of RHBQ 1.11 can't consume /health and /metrics properly, because doesn't follow redirects. 

       

      Github Ref
      Related Github Ref

              Unassigned Unassigned
              rhn-support-pagonzal Pablo Gonzalez Granados (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: