Class EmptyExternalResponseMessage
java.lang.Object
com.iohao.net.framework.protocol.EmptyExternalResponseMessage
- All Implemented Interfaces:
CommonResponse, FutureMessage
public final class EmptyExternalResponseMessage
extends Object
implements CommonResponse, FutureMessage
Lightweight external response that carries only error information and no payload.
Used when the external server needs to signal success or failure without returning any business data (e.g. acknowledgement-only responses).
- Since:
- 25.1
- Author:
- 渔民小镇
- date:
- 2025-09-18
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintError code; 0 indicates success, non-zero indicates an error.Human-readable error message;nullwhen the response is successful.longCorrelation id used to match this response to its originating request.static EmptyExternalResponseMessageof(long futureId) Create an empty response pre-populated with the given future id.voidsetErrorCode(int errorCode) Error code; 0 indicates success, non-zero indicates an error.voidsetErrorMessage(String errorMessage) Human-readable error message;nullwhen the response is successful.voidsetFutureId(long futureId) Correlation id used to match this response to its originating request.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface CommonResponse
hasError, isSuccess, setError
-
Constructor Details
-
EmptyExternalResponseMessage
public EmptyExternalResponseMessage()
-
-
Method Details
-
of
Create an empty response pre-populated with the given future id.- Parameters:
futureId- the correlation id of the originating request- Returns:
- a new
EmptyExternalResponseMessageinstance
-
setFutureId
public void setFutureId(long futureId) Correlation id used to match this response to its originating request.- Specified by:
setFutureIdin interfaceFutureMessage- Parameters:
futureId- the future id
-
setErrorCode
public void setErrorCode(int errorCode) Error code; 0 indicates success, non-zero indicates an error.- Specified by:
setErrorCodein interfaceCommonResponse- Parameters:
errorCode- the error code
-
setErrorMessage
Human-readable error message;nullwhen the response is successful.- Specified by:
setErrorMessagein interfaceCommonResponse- Parameters:
errorMessage- the error message
-
getFutureId
public long getFutureId()Correlation id used to match this response to its originating request.- Specified by:
getFutureIdin interfaceFutureMessage- Returns:
- the future id
-
getErrorCode
public int getErrorCode()Error code; 0 indicates success, non-zero indicates an error.- Specified by:
getErrorCodein interfaceCommonResponse- Returns:
- the error code
-
getErrorMessage
Human-readable error message;nullwhen the response is successful.- Specified by:
getErrorMessagein interfaceCommonResponse- Returns:
- the error message, or
nullon success
-