Interface UnboundExchange<A extends ExchangeContext>
- All Superinterfaces:
BaseExchange<A,
,Request, Mono<? extends Response>> 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 Summary
Modifier and TypeMethodDescriptionBinds the exchange to the specified endpoint.intercept
(ExchangeInterceptor<? super A, ? extends InterceptedExchange<A>> interceptor) Specifies an interceptor to intercept the exchange before it is sent to the endpoint.Methods inherited from interface io.inverno.mod.http.base.BaseExchange
context, getCancelCause, getProtocol, request, reset, reset
-
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
Exchange<A> bind(Endpoint<? super A> endpoint) throws IllegalArgumentException, IllegalStateException 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 theHttpClient
beanIllegalStateException
- if the exchange is already bound
-