Class ExternalRequestMessage

java.lang.Object
com.iohao.net.framework.protocol.ExternalRequestMessage
All Implemented Interfaces:
UserIdentity

public final class ExternalRequestMessage extends Object implements UserIdentity
Request message sent from an external (Netty) server to a logic server.

Carries user identity information, a trace id for distributed tracing, and the external server / template context. Extends ExternalCommonMessage with request-specific fields.

Since:
25.1
Author:
渔民小镇
date:
2025-09-10
  • Constructor Details

    • ExternalRequestMessage

      public ExternalRequestMessage()
  • Method Details

    • ofClone

      public ExternalRequestMessage ofClone()
      Create a shallow clone of this request message.
      Returns:
      a new ExternalRequestMessage with the same field values
    • getUserId

      public long getUserId()
      User id associated with this request.
      Specified by:
      getUserId in interface UserIdentity
      Returns:
      the user id
    • isVerifyIdentity

      public boolean isVerifyIdentity()
      Whether the user's identity has been verified (authenticated).
      Specified by:
      isVerifyIdentity in interface UserIdentity
      Returns:
      true if the identity is verified
    • getTemplateId

      public int getTemplateId()
      Template id of the external server that received the client connection.
    • getTraceId

      public String getTraceId()
      Distributed trace id for request tracking.
    • getNetId

      public int getNetId()
      Network id identifying the Aeron connection.
    • getExternalServerId

      public int getExternalServerId()
      Identifier of the originating external server.
    • setUserId

      public void setUserId(long userId)
      User id associated with this request.
      Specified by:
      setUserId in interface UserIdentity
      Parameters:
      userId - the user id
    • setVerifyIdentity

      public void setVerifyIdentity(boolean verifyIdentity)
      Whether the user's identity has been verified (authenticated).
      Specified by:
      setVerifyIdentity in interface UserIdentity
      Parameters:
      verifyIdentity - true if the identity is verified
    • setTemplateId

      public void setTemplateId(int templateId)
      Template id of the external server that received the client connection.
    • setTraceId

      public void setTraceId(String traceId)
      Distributed trace id for request tracking.
    • setNetId

      public void setNetId(int netId)
      Network id identifying the Aeron connection.
    • setExternalServerId

      public void setExternalServerId(int externalServerId)
      Identifier of the originating external server.
    • setPayload

      void setPayload(byte[] payload)
      Set the raw binary payload.
      Parameters:
      payload - the payload bytes
    • setPayload

      default void setPayload(int payload)
      Set the payload from an int value.
      Parameters:
      payload - the int value to serialize
    • setPayload

      default void setPayload(long payload)
      Set the payload from a long value.
      Parameters:
      payload - the long value to serialize
    • setPayload

      default void setPayload(boolean payload)
      Set the payload from a boolean value.
      Parameters:
      payload - the boolean value to serialize
    • setPayload

      default void setPayload(String payload)
      Set the payload from a String value.
      Parameters:
      payload - the string value to serialize
    • getFutureId

      public long getFutureId()
      Correlation id used to match asynchronous request/response pairs.
    • getPayload

      public byte[] getPayload()
      Serialized binary payload of the message.
    • setFutureId

      public void setFutureId(long futureId)
      Correlation id used to match asynchronous request/response pairs.
    • setPayload

      public void setPayload(byte[] payload)
      Serialized binary payload of the message.