public class BusMessage extends Object implements Serializable
Bus use BusMessage to exchange messages.| Modifier and Type | Class and Description |
|---|---|
static class |
BusMessage.AckPolicy |
| Constructor and Description |
|---|
BusMessage(int t,
byte[] d,
BusListenerId c) |
BusMessage(int t,
byte[] d,
BusListenerId c,
BusMessage.AckPolicy a) |
| Modifier and Type | Method and Description |
|---|---|
static BusMessage |
fromBytes(byte[] serialized,
long msgId,
long t)
Create BusMessage from serialized data
|
BusMessage.AckPolicy |
getAckPolicy()
Get ack policy for message
|
long |
getMessageId()
Get the Identifier assigned to the BusMessage.
|
int |
getMessageType()
Get the type of the BusMessage.
|
BusListenerId |
getMsgCreatorId()
Get Message creator ID
|
byte[] |
getPayload()
Get message's payload
|
long |
getPushTime()
Get time in milliseconds from epoch to when this message was pushed
|
byte[] |
serialize()
Serialize the message to a byte array
|
String |
toString() |
public BusMessage(int t,
byte[] d,
BusListenerId c)
t - message typed - pay load in byte arrayc - message creator idIllegalArgumentException - if pay load size is larger than
BusFactory.maxBusMsgPayloadSizepublic BusMessage(int t,
byte[] d,
BusListenerId c,
BusMessage.AckPolicy a)
t - message typed - pay load in byte arrayc - message creator ida - ack policy to setIllegalArgumentException - if pay load size is larger than
BusFactory.maxBusMsgPayloadSizepublic int getMessageType()
public long getMessageId()
public BusListenerId getMsgCreatorId()
public long getPushTime()
public byte[] getPayload()
public BusMessage.AckPolicy getAckPolicy()
public byte[] serialize()
throws IOException
IOException - on serialization errorpublic static BusMessage fromBytes(byte[] serialized, long msgId, long t) throws IOException, ClassNotFoundException
serialized - serialized bus messagemsgId - message idt - message typeIOException - on decode errorClassNotFoundException - on decode errorCopyright © 2014. All Rights Reserved.