public final class EMessageHeader extends Object
EMessage header information. This
includes the "from" proxy identifier, the "to" proxy
identifier, and the eBus EMessage. The proxy
identifiers are used to route messages between remote eBus
applications. The proxies are used to represent the remote
eBus' capability within the local JVM.
This class is immutable.
The binary serialization format for an eBus message header is:
KeyMessage.
NO_ID.
MessageType about eBus
message and field serialization.
Both the "to" and "from" feeds are encapsulated in an
ERemoteApp instance.
EMessage| Modifier and Type | Field and Description |
|---|---|
static int |
NO_ID
Proxy identifiers are set to -1 to signify that they are
unknown at the time the message was sent.
|
| Constructor and Description |
|---|
EMessageHeader(int classId,
int fromFeedId,
int toFeedId,
EMessage msg)
Creates a message header with the given key, from and to
feed identifiers and eBus message.
|
EMessageHeader(int classId,
int fromFeedId,
int toFeedId,
SocketAddress address,
EMessage msg)
Creates a message header with the given key, from and to
feed identifiers and eBus message.
|
| Modifier and Type | Method and Description |
|---|---|
SocketAddress |
address()
Returns the message source or destination address.
|
int |
classId()
Returns the unique class identifier.
|
int |
fromFeedId()
Returns the from proxy identifier.
|
boolean |
isSystemMessage()
Returns
true if the contained message is a
system message. |
EMessage |
message()
Returns the encapsulated eBus message.
|
Class<? extends EMessage> |
messageClass()
Returns the message class.
|
EMessageKey |
messageKey()
Returns the encapsulated message key.
|
EMessage.MessageType |
messageType()
Returns the encapsulated message type.
|
int |
toFeedId()
Returns the to proxy identifier.
|
String |
toString()
Returns this header as human-readable text.
|
public static final int NO_ID
public EMessageHeader(int classId,
int fromFeedId,
int toFeedId,
EMessage msg)
null.classId - the message class identifier.fromFeedId - the message is from this eBus proxy.
Will be NO_ID for
system messages only; all other
messages must set this to a value ≥ zero.toFeedId - the message is destined for this eBus
proxy. Will be NO_ID if the destination proxy is
unknown.msg - the eBus message.IllegalArgumentException - if msg is null or if msg is an
application message and classId or
fromFeedId is < zero.public EMessageHeader(int classId,
int fromFeedId,
int toFeedId,
SocketAddress address,
EMessage msg)
classId - the message class identifier.fromFeedId - the message is from this eBus proxy.
Will be NO_ID for
system messages only; all other
messages must set this to a value ≥ zero.toFeedId - the message is destined for this eBus
proxy. Will be NO_ID if the destination proxy is
unknown.address - message source or destination address. May
be null.msg - the eBus message.IllegalArgumentException - if msg is null or if msg is an
application message and classId or
fromFeedId is < zero.public Class<? extends EMessage> messageClass()
public boolean isSystemMessage()
true if the contained message is a
system message.true if a system message.public EMessage.MessageType messageType()
public EMessageKey messageKey()
public int classId()
public int fromFeedId()
ESystemMessage, then returns NO_ID.public int toFeedId()
NO_ID.public SocketAddress address()
null.public EMessage message()
Copyright © 2019. All rights reserved.