Class UserRequestMessage

java.lang.Object
com.iohao.net.framework.protocol.CommonMessage
com.iohao.net.framework.protocol.UserRequestMessage
All Implemented Interfaces:
FutureMessage, RemoteMessage, Request, UserIdentity

public final class UserRequestMessage extends CommonMessage implements Request
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 Details

    • userId

      protected long userId
    • verifyIdentity

      protected boolean verifyIdentity
    • msgId

      protected int msgId
    • cacheCondition

      protected int cacheCondition
    • errorCode

      protected int errorCode
      Code: 0 for success, others for errors.
    • errorMessage

      protected String errorMessage
      Exception message, JSR 380 validation message.
    • cmdCode

      protected transient int cmdCode
    • inetSocketAddress

      protected transient Object inetSocketAddress
    • externalMessage

      protected transient Object externalMessage
  • Constructor Details

    • UserRequestMessage

      public UserRequestMessage()
  • Method Details

    • setStick

      public void setStick(int stick)
      Description copied from interface: Request
      Set the sticky-routing hint used to pin this request to a specific server instance.
      Specified by:
      setStick in interface Request
      Parameters:
      stick - the sticky-routing value
    • setHopCount

      public void setHopCount(int hopCount)
      Description copied from interface: Request
      Set the number of hops this request has traversed.
      Specified by:
      setHopCount in interface Request
      Parameters:
      hopCount - the hop count to set
    • setBindingLogicServerIds

      public void setBindingLogicServerIds(int[] bindingLogicServerIds)
      Description copied from interface: Request
      Set the IDs of logic servers that this player is bound to.
      Specified by:
      setBindingLogicServerIds in interface Request
      Parameters:
      bindingLogicServerIds - array of bound logic server IDs
    • setAttachment

      public void setAttachment(byte[] attachment)
      Description copied from interface: Request
      Set the per-request attachment data.
      Specified by:
      setAttachment in interface Request
      Parameters:
      attachment - the attachment byte array
    • getStick

      public int getStick()
      Description copied from interface: Request
      Get the sticky-routing hint for this request.
      Specified by:
      getStick in interface Request
      Returns:
      the sticky-routing value, or 0 if not set
    • getHopCount

      public int getHopCount()
      Description copied from interface: Request
      Get the number of hops this request has traversed across logic servers.
      Specified by:
      getHopCount in interface Request
      Returns:
      the current hop count
    • getBindingLogicServerIds

      public int[] getBindingLogicServerIds()
      Description copied from interface: Request
      The IDs of multiple game logic servers bound to the player
          All 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:
      getBindingLogicServerIds in interface Request
      Returns:
      bindingLogicServerIds
    • getAttachment

      public byte[] getAttachment()
      Description copied from interface: Request
      Extended 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:
      getAttachment in interface Request
      Returns:
      AttachmentData
    • toString

      public String 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

      public String getErrorMessage()
      Exception message, JSR 380 validation message.
    • getCmdCode

      public int getCmdCode()
    • getInetSocketAddress

      public Object getInetSocketAddress()
    • getExternalMessage

      public Object 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

      public void setErrorMessage(String errorMessage)
      Exception message, JSR 380 validation message.
    • setCmdCode

      public void setCmdCode(int cmdCode)
    • setInetSocketAddress

      public void setInetSocketAddress(Object inetSocketAddress)
    • setExternalMessage

      public void setExternalMessage(Object externalMessage)