Riptide: A next generation HTTP client

Tidal wave

Stability: Active Build Status Coverage Status Code Quality Javadoc Release Maven Central License

Riptide noun, /ˈrɪp.taɪd/: strong flow of water away from the shore

Riptide is a library that implements client-side response routing. It tries to fill the gap between the HTTP protocol and Java. Riptide allows users to leverage the power of HTTP with its unique API.

:rotating_light: Upgrading from 2.x to 3.x? Please refer to the Migration Guide.


Usage typically looks like this:

http.get("/repos/{org}/{repo}/contributors", "zalando", "riptide")
        on(SUCCESSFUL).call(listOf(User.class), users -> 

Feel free to compare this e.g. to Feign or Retrofit.



Most modern clients try to adapt HTTP to a single-return paradigm as shown in the following example. Even though this may be perfectly suitable for most applications it takes away a lot of the power that comes with HTTP. It's not easy to support multiple different return values, i.e. distinct happy cases. Access to response headers or manual content negotiation are also harder to do.

List<User> getContributors(@PathParam String org, @PathParam String repo);

Riptide tries to counter this by providing a different approach to leverage the power of HTTP. Go checkout the concept document for more details.



Add the following dependency to your project:


Additional modules/artifacts of Riptide always share the same version number.

Alternatively, you can import our bill of materials...


... which allows you to omit versions:



Integration of your typical Spring Boot Application with Riptide, Logbook and Tracer can be greatly simplified by using the Riptide: Spring Boot Starter. Go check it out!

    .requestFactory(new HttpComponentsClientHttpRequestFactory())
    .converter(new MappingJackson2HttpMessageConverter())
    .converter(new Jaxb2RootElementHttpMessageConverter())
    .plugin(new OriginalStackTracePlugin())

The following code is the bare minimum, since a request factory is required:

    .requestFactory(new HttpComponentsClientHttpRequestFactory())

This defaults to:

Thread Pool

All off the standard*Pool() implementations only support the queue-first style, i.e. the pool scales up to the core pool size, then fills the queue and only then will scale up to the maximum pool size.

Riptide provides a ThreadPoolExecutors.builder() which also offers a scale-first style where thread pools scale up to the maximum pool size before they queue any tasks. That usually leads to higher throughput, lower latency on the expense of having to maintain more threads.

The following table shows which combination of properties are supported

Configuration Supported
Without queue, fixed size¹ :heavy_check_mark:
Without queue, elastic size² :heavy_check_mark:
Bounded queue, fixed size :heavy_check_mark:
Bounded queue, elastic size :heavy_check_mark:
Unbounded queue, fixed size :heavy_check_mark:
Unbounded queue, elastic size :x:³
Scale first, without queue, fixed size :x:⁴
Scale first, without queue, elastic size :x:⁴
Scale first, bounded queue, fixed size :x:⁵
Scale first, bounded queue, elastic size :heavy_check_mark:⁶
Scale first, unbounded queue, fixed size :x:⁵
Scale first, unbounded queue, elastic size :heavy_check_mark:⁶

¹ Core pool size = maximum pool size
² Core pool size < maximum pool size
³ Pool can't grow past core pool size due to unbounded queue
⁴ Scale first has no meaning without a queue
⁵ Fixed size pools are already scaled up
⁶ Elastic, but only between 0 and maximum pool size


  1. Without queue, elastic size

        .elasticSize(5, 20)
        .keepAlive(1, MINUTES)
  2. Bounded queue, fixed size

        .keepAlive(1, MINUTES)
  3. Scale-first, unbounded queue, elastic size

        .keepAlive(1, MINUTES)

You can read more about scale-first here:

In order to configure the thread pool correctly, please refer to How to set an ideal thread pool size.

Non-blocking IO

Riptide supports two different kinds of request factories:


The following implementations offer blocking IO:


The following implementations offer non-blocking IO:

Non-blocking IO is asynchronous by nature. In order to provide asynchrony for blocking IO you need to register an executor. Not passing an executor will make all network communication synchronous, i.e. all futures returned by Riptide will already be completed.

Synchronous Asynchronous
Blocking IO ClientHttpRequestFactory Executor + ClientHttpRequestFactory
Non-blocking IO n/a AsyncClientHttpRequestFactory



A full-blown request may contain any of the following aspects: HTTP method, request URI, query parameters, headers and a body:"/sales-order")
    .queryParam("async", "false")
    .header("Client-IP", "")

Riptide supports the following HTTP methods: get, head, post, put, patch, delete, options and trace respectively. Query parameters can either be provided individually using queryParam(String, String) or multiple at once with queryParams(Multimap<String, String>).

The following operations are applied to URI Templates (get(String, Object...)) and URIs (get(URI)) respectively:

URI Template



The URI Resolution table shows some examples how URIs are resolved against Base URLs, based on the chosen resolution strategy.

The Content-Type- and Accept-header have type-safe methods in addition to the generic support that is header(String, String) and headers(HttpHeaders).


Riptide is special in the way it handles responses. Rather than having a single return value, you need to register callbacks. Traditionally you would attach different callbacks for different response status codes, alternatively there are also built-in routing capabilities on status code families (called series in Spring) as well as on content types."/sales-order")
    // ...
            on(SALES_ORDER).call(SalesOrder.class, this::persist),

The callbacks can have the following signatures:



Riptide will return a CompletableFuture<ClientHttpResponse>. That means you can choose to chain transformations/callbacks or block on it.

If you need proper return values take a look at Riptide: Capture.


The only special custom exception you may get is UnexpectedResponseException, if and only if there was no matching condition and no wildcard condition either.


Riptide comes with a way to register extensions in the form of plugins.

Plugins are executed in phases:

Plugin phases

Please consult the Plugin documentation for details.


Riptide is built on the same foundation as Spring's RestTemplate and AsyncRestTemplate. That allows us, with a small trick, to use the same testing facilities, the MockRestServiceServer:

RestTemplate template = new RestTemplate();
MockRestServiceServer server = MockRestServiceServer.createServer(template);
ClientHttpRequestFactory requestFactory = template.getRequestFactory();

    // continue configuration

We basically use an intermediate RestTemplate as a holder of the special ClientHttpRequestFactory that the MockRestServiceServer manages.

If you are using the Spring Boot Starter the test setup is provided by a convenient annotation @RiptideClientTest, see here.

Getting help

If you have questions, concerns, bug reports, etc., please file an issue in this repository's Issue Tracker.

Getting involved/Contributing

To contribute, simply make a pull request and add a brief description (1-2 sentences) of your addition or change. For more details check the contribution guidelines.

Credits and references