Class RequestMessage
java.lang.Object
com.iohao.net.framework.protocol.CommonMessage
com.iohao.net.framework.protocol.RequestMessage
- All Implemented Interfaces:
FutureMessage, RemoteMessage, Request, UserIdentity
- Direct Known Subclasses:
SendMessage
Internal request message used for logic-to-logic server communication via Aeron.
Extends CommonMessage with Request fields including user identity,
hop tracking, logic-server binding, and per-request attachment. Provides factory
methods for creation and shallow cloning to support request forwarding across
logic server boundaries.
- Author:
- 渔民小镇
- date:
- 2025-09-02
-
Field Summary
Fields inherited from class CommonMessage
cmdMerge, data, externalServerId, futureId, logicServerId, nanoTime, netId, outputError, sourceServerId, traceId -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]Extended field.int[]The IDs of multiple game logic servers bound to the playerintGet the number of hops this request has traversed across logic servers.longGet the user id.booleanCheck whether the user's identity has been verified (authenticated).static RequestMessageCreate a newRequestMessagewith the given command route and payload.ofClone()Create a shallow clone of this request message, copying all routing and identity fields.voidsetAttachment(byte[] attachment) Set the per-request attachment data.voidsetBindingLogicServerIds(int[] bindingLogicServerIds) Set the IDs of logic servers that this player is bound to.voidsetHopCount(int hopCount) Set the number of hops this request has traversed.voidsetUserId(long userId) Set the user id.voidsetVerifyIdentity(boolean verifyIdentity) Set the identity verification flag.Methods inherited from class CommonMessage
getCmdInfo, getCmdMerge, getData, getExternalServerId, getFutureId, getLogicServerId, getNanoTime, getNetId, getOutputError, getSourceServerId, getTraceId, setCmdInfo, setCmdMerge, setData, setExternalServerId, setFutureId, setLogicServerId, setNanoTime, setNetId, setOutputError, setSourceServerId, setTraceId, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface FutureMessage
getFutureId, setFutureIdMethods inherited from interface RemoteMessage
getCmdInfo, getCmdMerge, getData, getExternalServerId, getLogicServerId, getNanoTime, getNetId, getSourceServerId, getTraceId, setCmdInfo, setCmdMerge, setData, setExternalServerId, setLogicServerId, setNanoTime, setNetId, setOutputError, setSourceServerId, setTraceIdMethods inherited from interface UserIdentity
bindingUserId, setUserIdentity, verifyIdentity
-
Constructor Details
-
RequestMessage
public RequestMessage()
-
-
Method Details
-
of
Create a newRequestMessagewith the given command route and payload.- Parameters:
cmdInfo- the command route descriptordata- the serialized request payload- Returns:
- a new request message
-
ofClone
Create a shallow clone of this request message, copying all routing and identity fields.Useful when forwarding a request to another logic server while preserving the original context.
- Returns:
- a new
RequestMessagewith the same field values
-
setUserId
public void setUserId(long userId) Description copied from interface:UserIdentitySet the user id.- Specified by:
setUserIdin interfaceUserIdentity- Parameters:
userId- the user id
-
setVerifyIdentity
public void setVerifyIdentity(boolean verifyIdentity) Description copied from interface:UserIdentitySet the identity verification flag.- Specified by:
setVerifyIdentityin interfaceUserIdentity- Parameters:
verifyIdentity-trueif the identity is verified
-
setHopCount
public void setHopCount(int hopCount) Description copied from interface:RequestSet the number of hops this request has traversed.- Specified by:
setHopCountin interfaceRequest- Parameters:
hopCount- the hop count to set
-
setBindingLogicServerIds
public void setBindingLogicServerIds(int[] bindingLogicServerIds) Description copied from interface:RequestSet the IDs of logic servers that this player is bound to.- Specified by:
setBindingLogicServerIdsin interfaceRequest- Parameters:
bindingLogicServerIds- array of bound logic server IDs
-
setAttachment
public void setAttachment(byte[] attachment) Description copied from interface:RequestSet the per-request attachment data.- Specified by:
setAttachmentin interfaceRequest- Parameters:
attachment- the attachment byte array
-
getUserId
public long getUserId()Description copied from interface:UserIdentityGet the user id.- Specified by:
getUserIdin interfaceUserIdentity- Returns:
- the user id
-
isVerifyIdentity
public boolean isVerifyIdentity()Description copied from interface:UserIdentityCheck whether the user's identity has been verified (authenticated).- Specified by:
isVerifyIdentityin interfaceUserIdentity- Returns:
trueif the identity is verified
-
getHopCount
public int getHopCount()Description copied from interface:RequestGet the number of hops this request has traversed across logic servers.- Specified by:
getHopCountin interfaceRequest- Returns:
- the current hop count
-
getBindingLogicServerIds
public int[] getBindingLogicServerIds()Description copied from interface:RequestThe IDs of multiple game logic servers bound to the playerAll requests related to this game logic server will be routed to the bound game logic server for processing. Even if multiple game logic servers of the same type are running, requests will still be directed to the originally bound server.- Specified by:
getBindingLogicServerIdsin interfaceRequest- Returns:
- bindingLogicServerIds
-
getAttachment
public byte[] getAttachment()Description copied from interface:RequestExtended field. Developers can use this field to extend meta-information for special business needs. The data in this field will be included with every request.- Specified by:
getAttachmentin interfaceRequest- Returns:
- AttachmentData
-