Class WebResponseGateway
- All Implemented Interfaces:
Namespaced<ResultGateway>, ResultGateway
Specialized implementation of the
ResultGateway interface for sending web response messages.
This class is responsible for handling responses to web requests, dispatching the result message to the specified
target using a GatewayClient.
The dispatch process utilizes the DispatchInterceptor and WebResponseMapper to modify or monitor
web responses before they are sent.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected WebResponseGatewaycreateForNamespace(String namespace) Sends a response with the specified payload, metadata, target, request ID, and delivery guarantee.protected CompletableFuture<Void> sendResponse(WebResponse response, Function<SerializedMessage, CompletableFuture<Void>> dispatcher) Methods inherited from class AbstractNamespaced
close, forNamespaceMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Namespaced
forDefaultNamespace, forNamespaceMethods inherited from interface ResultGateway
respond
-
Field Details
-
MAX_RESPONSE_SIZE
public static final int MAX_RESPONSE_SIZE- See Also:
-
-
Constructor Details
-
WebResponseGateway
public WebResponseGateway()
-
-
Method Details
-
createForNamespace
- Specified by:
createForNamespacein classAbstractNamespaced<ResultGateway>
-
respond
public CompletableFuture<Void> respond(Object payload, Metadata metadata, String target, Integer requestId, Guarantee guarantee) Description copied from interface:ResultGatewaySends a response with the specified payload, metadata, target, request ID, and delivery guarantee.This method gives full control over how and when the response is delivered.
- Specified by:
respondin interfaceResultGateway- Parameters:
payload- the payload of the responsemetadata- additional metadata to includetarget- the intended recipient of the responserequestId- the identifier of the original requestguarantee- delivery guarantee (e.g.,Guarantee.SENTorGuarantee.STORED)- Returns:
- a
CompletableFuturethat completes when the response is dispatched (depending on the guarantee)
-
sendResponse
protected CompletableFuture<Void> sendResponse(WebResponse response, Function<SerializedMessage, CompletableFuture<Void>> dispatcher)
-