Search in sources :

Example 1 with TracingClient

use of feign.opentracing.TracingClient in project cxf by apache.

the class Catalog method search.

@GET
@Path("/search")
@Produces(MediaType.APPLICATION_JSON)
public JsonObject search(@QueryParam("q") final String query, @Context final TracerContext tracing) throws Exception {
    final GoogleBooksApi api = Feign.builder().client(new TracingClient(new ApacheHttpClient(), tracing.unwrap(Tracer.class))).target(GoogleBooksApi.class, "https://www.googleapis.com");
    final feign.Response response = api.search(query);
    try (final Reader reader = response.body().asReader()) {
        return Json.createReader(reader).readObject();
    }
}
Also used : GoogleBooksApi(demo.jaxrs.tracing.GoogleBooksApi) Tracer(io.opentracing.Tracer) ApacheHttpClient(feign.httpclient.ApacheHttpClient) TracingClient(feign.opentracing.TracingClient) Reader(java.io.Reader) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Aggregations

GoogleBooksApi (demo.jaxrs.tracing.GoogleBooksApi)1 ApacheHttpClient (feign.httpclient.ApacheHttpClient)1 TracingClient (feign.opentracing.TracingClient)1 Tracer (io.opentracing.Tracer)1 Reader (java.io.Reader)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1