Interface Route

All Known Subinterfaces:
RoutingTree<A>
All Known Implementing Classes:
NoopRoute, NoRoute, PassRoute
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@API(status=STABLE) @FunctionalInterface public interface Route
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    static <I> Route
    call(com.google.common.reflect.TypeToken<I> type, org.zalando.fauxpas.ThrowingConsumer<I,? extends Exception> consumer)
     
    static <I> Route
    call(Class<I> type, org.zalando.fauxpas.ThrowingConsumer<I,? extends Exception> consumer)
     
    static Route
    call(org.zalando.fauxpas.ThrowingConsumer<org.springframework.http.client.ClientHttpResponse,? extends Exception> consumer)
     
    static Route
    call(org.zalando.fauxpas.ThrowingRunnable<? extends Exception> runnable)
     
    void
    execute(org.springframework.http.client.ClientHttpResponse response, MessageReader reader)
    Executes this route against the specific response.
    default Route
    merge(Route other)
     
  • Method Details

    • execute

      void execute(org.springframework.http.client.ClientHttpResponse response, MessageReader reader) throws Exception
      Executes this route against the specific response. It's within the responsibility of a route implementation to ensure the stream is consumed (optional) and properly closed. A fully consumed response stream allows for connection reuse and is therefore highly encouraged. Making sure that every response is properly closed ensures that stale connections are not exhausting the connection pool. Most routes will do both operations internally, but the responsibility can be handed over to the caller of the route by unmarshalling the stream into a Closeable or AutoCloseable bean.
      Parameters:
      response - the client response
      reader - a utility to unmarshall the response into Java beans
      Throws:
      Exception - if anything goes wrong during route execution, primarily used for IOException
    • merge

      default Route merge(Route other)
    • call

      static Route call(org.zalando.fauxpas.ThrowingRunnable<? extends Exception> runnable)
    • call

      static Route call(org.zalando.fauxpas.ThrowingConsumer<org.springframework.http.client.ClientHttpResponse,? extends Exception> consumer)
    • call

      static <I> Route call(Class<I> type, org.zalando.fauxpas.ThrowingConsumer<I,? extends Exception> consumer)
    • call

      static <I> Route call(com.google.common.reflect.TypeToken<I> type, org.zalando.fauxpas.ThrowingConsumer<I,? extends Exception> consumer)