Interface UnboundExchange<A extends ExchangeContext>

All Superinterfaces:
BaseExchange<A,Request,Mono<? extends Response>>, Exchange<A>

public interface UnboundExchange<A extends ExchangeContext> extends Exchange<A>

An Exchange which is not bound to any Endpoint.

An unbound exchange must be explicitly bound to an actual endpoint before it can be sent, bind(Endpoint) must be invoked before publishers returned by Exchange.response() or Exchange.webSocket() are subscribed.

Since:
1.12
Author:
Jeremy Kuhn
  • Method Details

    • intercept

      UnboundExchange<A> intercept(ExchangeInterceptor<? super A,? extends InterceptedExchange<A>> interceptor)

      Specifies an interceptor to intercept the exchange before it is sent to the endpoint.

      When invoked multiple time this method chains the interceptors one after the other. Interceptors specified on the exchange are executed after the ones defined on the endpoint processing the exchange.

      Parameters:
      interceptor - an exchange interceptor
      Returns:
      the unbounded exchange
    • bind

      Binds the exchange to the specified endpoint.

      An unbound exchange is created from the HttpClient, it must be bound to an actual endpoint in order to be sent.

      Note that an exchange is stateful and as such it can't be bound multiple times to different endpoints.

      Parameters:
      endpoint - the exchange to bind
      Returns:
      the bound exchange
      Throws:
      IllegalArgumentException - if the specified endpoint hasn't been obtained from the HttpClient bean
      IllegalStateException - if the exchange is already bound