Interface HttpMessageResponse
- All Superinterfaces:
BaseMessageResponse,BaseResponse,HttpBaseResponse
- All Known Subinterfaces:
HttpResponse,MessageResponse,Response
Represents a response that can manipulate a flow of messages.
- Author:
- Guillaume LAMIRAND (guillaume.lamirand at graviteesource.com), GraviteeSource Team
-
Method Summary
Modifier and TypeMethodDescriptionio.reactivex.rxjava3.core.Flowable<Message>messages()Get the response message flow as aFlowableofMessage.voidSet the response message flow.default io.reactivex.rxjava3.core.CompletableApplies a given transformation on each message.io.reactivex.rxjava3.core.CompletableonMessages(io.reactivex.rxjava3.core.FlowableTransformer<Message, Message> onMessages) Applies a given transformation on each message.Methods inherited from interface io.gravitee.gateway.reactive.api.context.http.HttpBaseResponse
ended, headers, isStatus1xx, isStatus2xx, isStatus3xx, isStatus4xx, isStatus5xx, reason, reason, status, status, trailers
-
Method Details
-
messages
io.reactivex.rxjava3.core.Flowable<Message> messages()Get the response message flow as aFlowableofMessage. WARN: you should not keep a direct reference on the message flow as it could be overridden by others at anytime.- Specified by:
messagesin interfaceBaseMessageResponse- Returns:
- a
FlowableofMessage.
-
messages
Set the response message flow. WARN:- Replacing the message flow DOES NOT take care of the previous message flow in place.
- You MUST ensure to consume the previous message flow when using it.
- You SHOULD consider using
onMessages(FlowableTransformer)oronMessage(Function)that may be more appropriate for message transformation.
- Specified by:
messagesin interfaceBaseMessageResponse- See Also:
-
onMessages
io.reactivex.rxjava3.core.Completable onMessages(io.reactivex.rxjava3.core.FlowableTransformer<Message, Message> onMessages) Applies a given transformation on each message. Ex:response.onMessages(messages -> messages.flatMap(message -> transformMyMessage(message)));- Specified by:
onMessagesin interfaceBaseMessageResponse- Parameters:
onMessages- the transformer that will be applied on each message.- Returns:
- a
Completablethat completes once the message transformation has been set up on the message flow (not executed).
-
onMessage
default io.reactivex.rxjava3.core.Completable onMessage(Function<Message, io.reactivex.rxjava3.core.Maybe<Message>> onMessage) Applies a given transformation on each message. Ex: Discard a message:response.onMessage(message -> Maybe.empty());Update a message:response.onMessage(message -> transformMyMessage(message));- Specified by:
onMessagein interfaceBaseMessageResponse- Parameters:
onMessage- the transformer that will be applied on each message.- Returns:
- a
Completablethat completes once the message transformation has been set up on the message flow (not executed).
-