Package com.onec.cluster
Record Class ClusterEvent
java.lang.Object
java.lang.Record
com.onec.cluster.ClusterEvent
- Record Components:
kind- payload shape tag; seeKIND_ENTITY_CHANGED.originNodeId- the publishing node's id, used by receivers to filter out their own echoes.changeType-created/updated/deleted/posted/unposted/changed.entityType-catalog/document/register.entityName- the entity's logical name, or*for a non-specific signal.id- the affected row's id as a string, ornull.naturalKey- the business key (catalog code / document number), ornull.
public record ClusterEvent(String kind, String originNodeId, String changeType, String entityType, String entityName, String id, String naturalKey)
extends Record
Wire form of a cross-node change notice carried by a
ClusterEventBus.
It mirrors the fields of com.onec.events.EntityChangedEvent (kept as plain strings so
the record is trivial to serialize and the core module stays free of spring-context and
Jackson annotations), plus two transport-only fields:
kind— a tag identifying the payload shape, so a future event kind can share the same channel without a wire break. Today the only value isKIND_ENTITY_CHANGED.originNodeId— the id of the node that published the event. A bus delivers an event back to its own subscribers (PostgresNOTIFYechoes to the publisher'sLISTEN), so receivers drop events whose origin equals their own node id: the originating node already fanned the change out to its local SSE clients synchronously.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringkindvalue for an entity-change notice mirroringEntityChangedEvent. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thechangeTyperecord component.static ClusterEvententityChanged(String changeType, String entityType, String entityName, String id, String naturalKey) Build anKIND_ENTITY_CHANGEDevent with nooriginNodeIdset — the publishingClusterEventBusstamps that duringClusterEventBus.publish(com.onec.cluster.ClusterEvent).Returns the value of theentityNamerecord component.Returns the value of theentityTyperecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.id()Returns the value of theidrecord component.kind()Returns the value of thekindrecord component.Returns the value of thenaturalKeyrecord component.Returns the value of theoriginNodeIdrecord component.final StringtoString()Returns a string representation of this record class.withOrigin(String originNodeId) A copy of this event withoriginNodeIdset — used by a bus to stamp its identity on send.
-
Field Details
-
KIND_ENTITY_CHANGED
kindvalue for an entity-change notice mirroringEntityChangedEvent.- See Also:
-
-
Constructor Details
-
ClusterEvent
public ClusterEvent(String kind, String originNodeId, String changeType, String entityType, String entityName, String id, String naturalKey) Creates an instance of aClusterEventrecord class.- Parameters:
kind- the value for thekindrecord componentoriginNodeId- the value for theoriginNodeIdrecord componentchangeType- the value for thechangeTyperecord componententityType- the value for theentityTyperecord componententityName- the value for theentityNamerecord componentid- the value for theidrecord componentnaturalKey- the value for thenaturalKeyrecord component
-
-
Method Details
-
entityChanged
public static ClusterEvent entityChanged(String changeType, String entityType, String entityName, String id, String naturalKey) Build anKIND_ENTITY_CHANGEDevent with nooriginNodeIdset — the publishingClusterEventBusstamps that duringClusterEventBus.publish(com.onec.cluster.ClusterEvent). This is the form the change-relay constructs, so it never needs to know the local node id. -
withOrigin
A copy of this event withoriginNodeIdset — used by a bus to stamp its identity on send. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
kind
Returns the value of thekindrecord component.- Returns:
- the value of the
kindrecord component
-
originNodeId
Returns the value of theoriginNodeIdrecord component.- Returns:
- the value of the
originNodeIdrecord component
-
changeType
Returns the value of thechangeTyperecord component.- Returns:
- the value of the
changeTyperecord component
-
entityType
Returns the value of theentityTyperecord component.- Returns:
- the value of the
entityTyperecord component
-
entityName
Returns the value of theentityNamerecord component.- Returns:
- the value of the
entityNamerecord component
-
id
Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
naturalKey
Returns the value of thenaturalKeyrecord component.- Returns:
- the value of the
naturalKeyrecord component
-