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 Details

    • EmptyExternalResponseMessage

      public EmptyExternalResponseMessage()
  • Method Details

    • of

      public static EmptyExternalResponseMessage of(long futureId)
      Create an empty response pre-populated with the given future id.
      Parameters:
      futureId - the correlation id of the originating request
      Returns:
      a new EmptyExternalResponseMessage instance
    • setFutureId

      public void setFutureId(long futureId)
      Correlation id used to match this response to its originating request.
      Specified by:
      setFutureId in interface FutureMessage
      Parameters:
      futureId - the future id
    • setErrorCode

      public void setErrorCode(int errorCode)
      Error code; 0 indicates success, non-zero indicates an error.
      Specified by:
      setErrorCode in interface CommonResponse
      Parameters:
      errorCode - the error code
    • setErrorMessage

      public void setErrorMessage(String errorMessage)
      Human-readable error message; null when the response is successful.
      Specified by:
      setErrorMessage in interface CommonResponse
      Parameters:
      errorMessage - the error message
    • getFutureId

      public long getFutureId()
      Correlation id used to match this response to its originating request.
      Specified by:
      getFutureId in interface FutureMessage
      Returns:
      the future id
    • getErrorCode

      public int getErrorCode()
      Error code; 0 indicates success, non-zero indicates an error.
      Specified by:
      getErrorCode in interface CommonResponse
      Returns:
      the error code
    • getErrorMessage

      public String getErrorMessage()
      Human-readable error message; null when the response is successful.
      Specified by:
      getErrorMessage in interface CommonResponse
      Returns:
      the error message, or null on success