Interface ExternalResponse
- All Superinterfaces:
CommonResponse, FutureMessage
- All Known Implementing Classes:
ExternalResponseMessage
Response returned from an external (Netty) server.
Combines CommonResponse error handling, binary payload read/write
capabilities, and future correlation into a single contract. Implementations
carry the id of the external server that produced the response.
- Since:
- 25.1
- Author:
- 渔民小镇
- date:
- 2025-09-16
-
Method Summary
Modifier and TypeMethodDescriptionintGet the identifier of the external server that produced this response.byte[]Get the raw binary payload.default booleanDeserialize the payload as aboolean.default intDeserialize the payload as anint.default longDeserialize the payload as along.default StringDeserialize the payload as aString.default voidsetPayload(boolean payload) Set the payload from abooleanvalue.voidsetPayload(byte[] payload) Set the raw binary payload.default voidsetPayload(int payload) Set the payload from anintvalue.default voidsetPayload(long payload) Set the payload from alongvalue.default voidsetPayload(String payload) Set the payload from aStringvalue.Methods inherited from interface CommonResponse
getErrorCode, getErrorMessage, hasError, isSuccess, setError, setErrorCode, setErrorMessageMethods inherited from interface FutureMessage
getFutureId, setFutureId
-
Method Details
-
getExternalServerId
int getExternalServerId()Get the identifier of the external server that produced this response.- Returns:
- the external server id
-
getPayload
byte[] getPayload()Get the raw binary payload.- Returns:
- the payload bytes
-
getPayloadAsInt
default int getPayloadAsInt()Deserialize the payload as anint.- Returns:
- the int value
-
getPayloadAsLong
default long getPayloadAsLong()Deserialize the payload as along.- Returns:
- the long value
-
getPayloadAsBool
default boolean getPayloadAsBool()Deserialize the payload as aboolean.- Returns:
- the boolean value
-
getPayloadAsString
-
setPayload
void setPayload(byte[] payload) Set the raw binary payload.- Parameters:
payload- the payload bytes
-
setPayload
default void setPayload(int payload) Set the payload from anintvalue.- Parameters:
payload- the int value to serialize
-
setPayload
default void setPayload(long payload) Set the payload from alongvalue.- Parameters:
payload- the long value to serialize
-
setPayload
default void setPayload(boolean payload) Set the payload from abooleanvalue.- Parameters:
payload- the boolean value to serialize
-
setPayload
-