Class EventBusMessage
java.lang.Object
com.iohao.net.framework.communication.eventbus.EventBusMessage
Event message carrying the event source data, topic, routing info, and fire type flags
for the EventBus system.
- Since:
- 21
- Author:
- 渔民小镇
- date:
- 2023-12-24
-
Field Summary
FieldsModifier and TypeFieldDescriptionbyte[]Serialized event source data for cross-process transmission.Remote server messages from other processes that have matching subscribers.The deserialized event source object (local only, not serialized).intBitmask of fire types that have been applied to this message.intThe target server ID this message is destined for.intThe server ID of the EventBus that originally published this event.longThread index used for executor selection in thread-safe strategies.The event topic, typically the fully qualified class name of the event source.Trace ID for distributed tracing and debugging. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFireType(int fireType) Adds the type of subscriber that has already been triggeredbooleancontainsFireType(int fireType) Checks if the type of subscriber that has already been triggered existsbooleanCheck if no fire type flags have been set.ofClone(int serverId) Create a shallow clone of this message targeting a different server ID.voidsetEventSource(Object eventSource) Set the event source and auto-derive the topic from its class name.
-
Field Details
-
serverId
public int serverIdThe target server ID this message is destined for. -
threadIndex
public long threadIndexThread index used for executor selection in thread-safe strategies. -
traceId
Trace ID for distributed tracing and debugging. -
topic
The event topic, typically the fully qualified class name of the event source. -
data
public byte[] dataSerialized event source data for cross-process transmission. -
sourceServerId
public transient int sourceServerIdThe server ID of the EventBus that originally published this event. -
eventSource
The deserialized event source object (local only, not serialized). -
eventServerMessages
Remote server messages from other processes that have matching subscribers. -
fireType
public transient int fireTypeBitmask of fire types that have been applied to this message.
-
-
Constructor Details
-
EventBusMessage
public EventBusMessage()
-
-
Method Details
-
setEventSource
Set the event source and auto-derive the topic from its class name.- Parameters:
eventSource- the event source object
-
containsFireType
public boolean containsFireType(int fireType) Checks if the type of subscriber that has already been triggered exists- Parameters:
fireType-EventBusFireType- Returns:
- true if it exists
- See Also:
-
addFireType
public void addFireType(int fireType) Adds the type of subscriber that has already been triggered- Parameters:
fireType-EventBusFireType- See Also:
-
emptyFireType
public boolean emptyFireType()Check if no fire type flags have been set.- Returns:
- true if no fire type has been applied
-
ofClone
Create a shallow clone of this message targeting a different server ID.- Parameters:
serverId- the target server ID for the cloned message- Returns:
- a new EventBusMessage with the same data but a different server ID
-