Package org.eclipse.keyple.distributed
Class MessageDto
- java.lang.Object
-
- org.eclipse.keyple.distributed.MessageDto
-
public class MessageDto extends java.lang.ObjectThis 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 Summary
Constructors Constructor Description MessageDto()Constructor.MessageDto(MessageDto from)Constructor by copy.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetAction()Returns the name of the internal action to perform in case of a request, or the original action performed in case of a response.intgetApiLevel()Returns the API level or 0 if the message is received from a system using a version of this library lower than2.3.0java.lang.StringgetBody()Returns the body content.java.lang.StringgetClientNodeId()Returns the client node id.java.lang.StringgetLocalReaderName()Returns the name of the local reader name associated to the transaction.java.lang.StringgetRemoteReaderName()Returns the name of the remote reader associated to the transaction.java.lang.StringgetServerNodeId()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.java.lang.StringgetSessionId()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.MessageDtosetAction(java.lang.String action)This setter method must only be used during the deserialization process.MessageDtosetApiLevel(int apiLevel)This setter method must only be used during the deserialization process.MessageDtosetBody(java.lang.String body)This setter method must only be used during the deserialization process.MessageDtosetClientNodeId(java.lang.String clientNodeId)This setter method must only be used during the deserialization process.MessageDtosetLocalReaderName(java.lang.String localReaderName)This setter method must only be used during the deserialization process.MessageDtosetRemoteReaderName(java.lang.String remoteReaderName)This setter method must only be used during the deserialization process.MessageDtosetServerNodeId(java.lang.String serverNodeId)This setter method must only be used during the deserialization process.MessageDtosetSessionId(java.lang.String sessionId)This setter method must only be used during the deserialization process.
-
-
-
Constructor Detail
-
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 Detail
-
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 than2.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 java.lang.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(java.lang.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 java.lang.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(java.lang.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 java.lang.String getClientNodeId()
Returns the client node id.- Returns:
- a not empty string.
- Since:
- 2.0.0
-
setClientNodeId
public final MessageDto setClientNodeId(java.lang.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 java.lang.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(java.lang.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 java.lang.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(java.lang.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 java.lang.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(java.lang.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 java.lang.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(java.lang.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
-
-