Class MessageDto

java.lang.Object
org.eclipse.keyple.distributed.MessageDto

public class MessageDto extends Object
This POJO contains data exchanged between Local and Remote components.

It is built and processed by the main distributed components, and you don't have to modify it.

You only need to transfer it via the network by serializing and deserializing it on your own.

However, it is necessary in some contexts to access certain information such as the sessionId in the case of asynchronous communication or the serverNodeId in the case of synchronous communication with several server instances.

Note that you can extend it or encapsulate it in another object if you need to transport other technical information related to the network infrastructure for example.

Since:
2.0.0
  • Constructor Details

    • MessageDto

      public MessageDto()
      Constructor.
      Since:
      2.0.0
    • MessageDto

      public MessageDto(MessageDto from)
      Constructor by copy.
      Parameters:
      from - The source dto to copy.
      Since:
      2.0.0
  • Method Details

    • getApiLevel

      public final int getApiLevel()
      Returns the API level or 0 if the message is received from a system using a version of this library lower than 2.3.0
      Returns:
      A positive value or 0 if the message is received from a system using a version of this library lower than 2.3.0
      Since:
      2.3.0
    • setApiLevel

      public final MessageDto setApiLevel(int apiLevel)
      This setter method must only be used during the deserialization process.
      Parameters:
      apiLevel - The API level to set.
      Returns:
      the object instance.
      Since:
      2.3.0
    • getSessionId

      public final String getSessionId()
      Returns the session id.
      In case of a full duplex communication, this field will permit to client and server to identify the socket.
      This id is also useful for debugging.
      Returns:
      a not empty string.
      Since:
      2.0.0
    • setSessionId

      public final MessageDto setSessionId(String sessionId)
      This setter method must only be used during the deserialization process.
      Parameters:
      sessionId - The session id to set.
      Returns:
      the object instance.
      Since:
      2.0.0
    • getAction

      public final String getAction()
      Returns the name of the internal action to perform in case of a request, or the original action performed in case of a response.
      Returns:
      a not empty string.
      Since:
      2.0.0
    • setAction

      public final MessageDto setAction(String action)
      This setter method must only be used during the deserialization process.
      Parameters:
      action - The action to set.
      Returns:
      the object instance.
      Since:
      2.0.0
    • getClientNodeId

      public final String getClientNodeId()
      Returns the client node id.
      Returns:
      a not empty string.
      Since:
      2.0.0
    • setClientNodeId

      public final MessageDto setClientNodeId(String clientNodeId)
      This setter method must only be used during the deserialization process.
      Parameters:
      clientNodeId - The client node id to set.
      Returns:
      the object instance.
      Since:
      2.0.0
    • getServerNodeId

      public final String getServerNodeId()
      Returns the server node id.
      In case of a multi-servers environment, this field will permit to client or load balancer to identify the target server to access.
      Returns:
      a null string in case of the first transaction call.
      Since:
      2.0.0
    • setServerNodeId

      public final MessageDto setServerNodeId(String serverNodeId)
      This setter method must only be used during the deserialization process.
      Parameters:
      serverNodeId - The server node id to set.
      Returns:
      the object instance.
      Since:
      2.0.0
    • getLocalReaderName

      public final String getLocalReaderName()
      Returns the name of the local reader name associated to the transaction.
      Returns:
      a null string in case of a discovering readers call.
      Since:
      2.0.0
    • setLocalReaderName

      public final MessageDto setLocalReaderName(String localReaderName)
      This setter method must only be used during the deserialization process.
      Parameters:
      localReaderName - The local reader name to set.
      Returns:
      the object instance.
      Since:
      2.0.0
    • getRemoteReaderName

      public final String getRemoteReaderName()
      Returns the name of the remote reader associated to the transaction.
      Returns:
      a null string in case of a discovering readers call.
      Since:
      2.0.0
    • setRemoteReaderName

      public final MessageDto setRemoteReaderName(String remoteReaderName)
      This setter method must only be used during the deserialization process.
      Parameters:
      remoteReaderName - The remote reader name to set.
      Returns:
      the object instance.
      Since:
      2.0.0
    • getBody

      public final String getBody()
      Returns the body content.
      Returns:
      a null string in case of an error message.
      Since:
      2.0.0
    • setBody

      public final MessageDto setBody(String body)
      This setter method must only be used during the deserialization process.
      Parameters:
      body - The body to set.
      Returns:
      the object instance.
      Since:
      2.0.0