public abstract class ENotificationMessage extends EMessage implements java.io.Serializable
publisherId
and
position
. publisherId
can be used to uniquely
define a publisher when there are multiple publishers for
the same message key within a system. It is the application's
responsibility to define the meaning and uniqueness of
publisher identifiers.
Position is used to define message ordering when notification
messages are published at a rate faster than wallclock time
granularity. In other words, there are multiple notification
messages per timestamp. If these messages are persisted then
message ordering may be lost on retrieval. The
position
field may be used as an index within a
given time limit to guarantee correct ordering when retrieved
from persistent store.
Combining subject
, timestamp
,
publisherId
, and position
guarantees a unique
index for any notification message placed into persistent
store if publisher identifier and message position
are correctly used.
ERequestMessage
,
EReplyMessage
,
Serialized FormModifier and Type | Class and Description |
---|---|
static class |
ENotificationMessage.Builder<M extends ENotificationMessage,B extends ENotificationMessage.Builder<M,?>>
Base class for all
ENotificationMessage builders. |
EMessage.MessageType
Modifier and Type | Field and Description |
---|---|
static long |
NO_PUB_ID
publisherId defaults to 0L when not set. |
int |
position
This optional field is meant to be used to maintain
notification order when placed in persistent store.
|
long |
publisherId
Optional field used to define the publisher which
produced this notification.
|
MAX_SUBJECT_LENGTH, subject, timestamp
Modifier | Constructor and Description |
---|---|
protected |
ENotificationMessage(ENotificationMessage.Builder<?,?> builder)
Creates a new eBus notification message based on the given
message builder.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o)
Returns
true if o is a
non-null ENotificationMessage instance with a
publisher identifier and position equal to
this ENotificationMessage instance and
false otherwise. |
int |
hashCode()
Returns notification message hash code.
|
java.lang.String |
toString()
Returns notification message publisher ID and position as
a string.
|
isApplicationMessage, isSystemMessage, key, messageType
public static final long NO_PUB_ID
publisherId
defaults to 0L when not set.public final long publisherId
Therefore the meaning of this identifier is within the application. If this identifier needs to be unique between application instances and across networks, then it is up to developers to guarantee identifier uniqueness.
If the publisher identifier is not defined then it
defaults to NO_PUB_ID
.
public final int position
EMessage.timestamp
alone.
The solution is to combine timestamp
with
position
which is incremented after each
publish. There is one position index per unique
message key
and publisherId
.
Depending on message publishing rate this position index
should be reset at a fixed rate to prevent the index
from going past Integer.MAX_VALUE
(2,147,483,647).
This value defaults to zero when not defined.
protected ENotificationMessage(ENotificationMessage.Builder<?,?> builder)
builder
is guaranteed to contain
a valid message configuration at this point.builder
- contains the eBus notification message
configuration.public boolean equals(java.lang.Object o)
true
if o
is a
non-null ENotificationMessage
instance with a
publisher identifier and position equal to
this ENotificationMessage
instance and
false
otherwise.public int hashCode()
Copyright © 2001 - 2024. Charles W. Rapp. All rights reserved.