Class ClusterMessage
- java.lang.Object
-
- org.onosproject.store.cluster.messaging.ClusterMessage
-
public class ClusterMessage extends Object
Base message for cluster-wide communications.
-
-
Constructor Summary
Constructors Constructor Description ClusterMessage(NodeId sender, MessageSubject subject, byte[] payload)
Creates a cluster message.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
static ClusterMessage
fromBytes(byte[] bytes)
Decodes a new ClusterMessage from raw bytes.byte[]
getBytes()
Serializes this instance.int
hashCode()
byte[]
payload()
Returns the message payload.void
respond(byte[] data)
Records the response to be sent to the sender.byte[]
response()
Returns the response to be sent to the sender.NodeId
sender()
Returns the id of the controller sending this message.MessageSubject
subject()
Returns the message subject indicator.String
toString()
-
-
-
Constructor Detail
-
ClusterMessage
public ClusterMessage(NodeId sender, MessageSubject subject, byte[] payload)
Creates a cluster message.- Parameters:
sender
- message sendersubject
- message subjectpayload
- message payload
-
-
Method Detail
-
sender
public NodeId sender()
Returns the id of the controller sending this message.- Returns:
- message sender id.
-
subject
public MessageSubject subject()
Returns the message subject indicator.- Returns:
- message subject
-
payload
public byte[] payload()
Returns the message payload.- Returns:
- message payload.
-
respond
public void respond(byte[] data)
Records the response to be sent to the sender.- Parameters:
data
- response payload
-
response
public byte[] response()
Returns the response to be sent to the sender.- Returns:
- response bytes
-
getBytes
public byte[] getBytes()
Serializes this instance.- Returns:
- bytes
-
fromBytes
public static ClusterMessage fromBytes(byte[] bytes)
Decodes a new ClusterMessage from raw bytes.- Parameters:
bytes
- raw bytes- Returns:
- cluster message
-
-