Class ExternalMessage
java.lang.Object
com.iohao.net.framework.protocol.AbstractCommunicationMessage
com.iohao.net.external.core.message.ExternalMessage
- All Implemented Interfaces:
CommonResponse, CommunicationMessage, FutureMessage, RemoteMessage, Request, UserIdentity
Default external transport message used between clients and the external server.
Document
- Author:
- 渔民小镇
- date:
- 2023-02-21
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintCommand type:0heartbeat,1business request.intMerged route command (high 16 bits main cmd, low 16 bits sub cmd).byte[]getData()Encoded business payload.intResponse or error code, where0means success.Validation or failure details, usually an error/exception message.intgetMsgId()Client message identifier echoed back by the server response.intProtocol-level feature switches, such as encryption or signature validation.voidsetCmdCode(int cmdCode) Command type:0heartbeat,1business request.voidsetCmdMerge(int cmdMerge) Merged route command (high 16 bits main cmd, low 16 bits sub cmd).voidsetData(byte[] data) Encoded business payload.voidsetErrorCode(int errorCode) Response or error code, where0means success.voidsetErrorMessage(String errorMessage) Validation or failure details, usually an error/exception message.voidsetMsgId(int msgId) Client message identifier echoed back by the server response.voidsetProtocolSwitch(int protocolSwitch) Protocol-level feature switches, such as encryption or signature validation.toString()Methods inherited from class AbstractCommunicationMessage
getAttachment, getBindingLogicServerIds, getCacheCondition, getExternalServerId, getFutureId, getHopCount, getInetSocketAddress, getLogicServerId, getNanoTime, getNetId, getOther, getSourceServerId, getStick, getTraceId, getUserId, isVerifyIdentity, setAttachment, setBindingLogicServerIds, setCacheCondition, setCmdInfo, setExternalServerId, setFutureId, setHopCount, setInetSocketAddress, setLogicServerId, setNanoTime, setNetId, setOther, setOutputError, setSourceServerId, setStick, setTraceId, setUserId, setVerifyIdentityMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface CommonResponse
hasError, isSuccess, setErrorMethods inherited from interface CommunicationMessage
getCmdInfoMethods inherited from interface UserIdentity
bindingUserId, setUserIdentity, verifyIdentity
-
Constructor Details
-
ExternalMessage
public ExternalMessage()
-
-
Method Details
-
toString
-
getCmdCode
public int getCmdCode()Command type:0heartbeat,1business request.- Specified by:
getCmdCodein interfaceCommunicationMessage- Overrides:
getCmdCodein classAbstractCommunicationMessage- Returns:
- the command code
-
getProtocolSwitch
public int getProtocolSwitch()Protocol-level feature switches, such as encryption or signature validation.- Specified by:
getProtocolSwitchin interfaceCommunicationMessage- Overrides:
getProtocolSwitchin classAbstractCommunicationMessage- Returns:
- the protocol switch bitmask
-
getCmdMerge
public int getCmdMerge()Merged route command (high 16 bits main cmd, low 16 bits sub cmd).- Returns:
- the merged command key
-
getErrorCode
public int getErrorCode()Response or error code, where0means success.- Specified by:
getErrorCodein interfaceCommonResponse- Overrides:
getErrorCodein classAbstractCommunicationMessage- Returns:
- the error code
-
getErrorMessage
Validation or failure details, usually an error/exception message.- Specified by:
getErrorMessagein interfaceCommonResponse- Overrides:
getErrorMessagein classAbstractCommunicationMessage- Returns:
- the error message, or
nullon success
-
getData
public byte[] getData()Encoded business payload.- Returns:
- the payload byte array
-
getMsgId
public int getMsgId()Client message identifier echoed back by the server response.- Specified by:
getMsgIdin interfaceCommunicationMessage- Overrides:
getMsgIdin classAbstractCommunicationMessage- Returns:
- the message ID
-
setCmdCode
public void setCmdCode(int cmdCode) Command type:0heartbeat,1business request.- Specified by:
setCmdCodein interfaceCommunicationMessage- Overrides:
setCmdCodein classAbstractCommunicationMessage- Parameters:
cmdCode- the command code
-
setProtocolSwitch
public void setProtocolSwitch(int protocolSwitch) Protocol-level feature switches, such as encryption or signature validation.- Specified by:
setProtocolSwitchin interfaceCommunicationMessage- Overrides:
setProtocolSwitchin classAbstractCommunicationMessage- Parameters:
protocolSwitch- the protocol switch bitmask
-
setCmdMerge
public void setCmdMerge(int cmdMerge) Merged route command (high 16 bits main cmd, low 16 bits sub cmd).- Parameters:
cmdMerge- the merged command key
-
setErrorCode
public void setErrorCode(int errorCode) Response or error code, where0means success.- Specified by:
setErrorCodein interfaceCommonResponse- Overrides:
setErrorCodein classAbstractCommunicationMessage- Parameters:
errorCode- the error code
-
setErrorMessage
Validation or failure details, usually an error/exception message.- Specified by:
setErrorMessagein interfaceCommonResponse- Overrides:
setErrorMessagein classAbstractCommunicationMessage- Parameters:
errorMessage- the error message
-
setData
public void setData(byte[] data) Encoded business payload.- Parameters:
data- the payload byte array
-
setMsgId
public void setMsgId(int msgId) Client message identifier echoed back by the server response.- Specified by:
setMsgIdin interfaceCommunicationMessage- Overrides:
setMsgIdin classAbstractCommunicationMessage- Parameters:
msgId- the message ID
-