Class UserRequestMessage
java.lang.Object
com.iohao.net.framework.protocol.CommonMessage
com.iohao.net.framework.protocol.UserRequestMessage
- All Implemented Interfaces:
FutureMessage, RemoteMessage, Request, UserIdentity
User-facing request message received from the external Netty pipeline.
Extends BarMessage and implements Request to carry the full set of
request fields: sticky-routing hint, hop count, logic-server bindings, and per-request
attachment data. This is the concrete message type created by the external server
handlers and forwarded to logic servers via Aeron for action dispatch.
- Author:
- 渔民小镇
- date:
- 2021-12-20
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected intprotected intCode: 0 for success, others for errors.protected StringException message, JSR 380 validation message.protected Objectprotected Objectprotected intprotected longprotected booleanFields 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 playerintintintCode: 0 for success, others for errors.Exception message, JSR 380 validation message.intGet the number of hops this request has traversed across logic servers.intgetMsgId()intgetStick()Get the sticky-routing hint for this request.longbooleanvoidsetAttachment(byte[] attachment) Set the per-request attachment data.voidsetBindingLogicServerIds(int[] bindingLogicServerIds) Set the IDs of logic servers that this player is bound to.voidsetCacheCondition(int cacheCondition) voidsetCmdCode(int cmdCode) voidsetErrorCode(int errorCode) Code: 0 for success, others for errors.voidsetErrorMessage(String errorMessage) Exception message, JSR 380 validation message.voidsetExternalMessage(Object externalMessage) voidsetHopCount(int hopCount) Set the number of hops this request has traversed.voidsetInetSocketAddress(Object inetSocketAddress) voidsetMsgId(int msgId) voidsetStick(int stick) Set the sticky-routing hint used to pin this request to a specific server instance.voidsetUserId(long userId) voidsetVerifyIdentity(boolean verifyIdentity) toString()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, setTraceIdMethods 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, getUserId, isVerifyIdentity, setUserId, setUserIdentity, setVerifyIdentity, verifyIdentity
-
Field Details
-
userId
protected long userId -
verifyIdentity
protected boolean verifyIdentity -
msgId
protected int msgId -
cacheCondition
protected int cacheCondition -
errorCode
protected int errorCodeCode: 0 for success, others for errors. -
errorMessage
Exception message, JSR 380 validation message. -
cmdCode
protected transient int cmdCode -
inetSocketAddress
-
externalMessage
-
-
Constructor Details
-
UserRequestMessage
public UserRequestMessage()
-
-
Method Details
-
setStick
-
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
-
getStick
-
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
-
toString
-
getUserId
public long getUserId() -
isVerifyIdentity
public boolean isVerifyIdentity() -
getMsgId
public int getMsgId() -
getCacheCondition
public int getCacheCondition() -
getErrorCode
public int getErrorCode()Code: 0 for success, others for errors. -
getErrorMessage
Exception message, JSR 380 validation message. -
getCmdCode
public int getCmdCode() -
getInetSocketAddress
-
getExternalMessage
-
setUserId
public void setUserId(long userId) -
setVerifyIdentity
public void setVerifyIdentity(boolean verifyIdentity) -
setMsgId
public void setMsgId(int msgId) -
setCacheCondition
public void setCacheCondition(int cacheCondition) -
setErrorCode
public void setErrorCode(int errorCode) Code: 0 for success, others for errors. -
setErrorMessage
Exception message, JSR 380 validation message. -
setCmdCode
public void setCmdCode(int cmdCode) -
setInetSocketAddress
-
setExternalMessage
-