Package su.onno.cluster
Record Class ClusterEvent.Presence
java.lang.Object
java.lang.Record
su.onno.cluster.ClusterEvent.Presence
- Record Components:
originNodeId- the publishing node's id, ornullbefore a bus stamps it.action-ENTER,HEARTBEAT, orLEAVE.entityType- the viewed record's entity type (catalog/document).entityName- the viewed record's logical name.id- the viewed record's id as a string.userId- a stable id for the viewing user (their domain record id, or username).displayName- the viewing user's display name, for rendering the avatar/marker.avatarUrl- the viewing user's avatar image URL, ornull(the marker then falls back to initials).
- All Implemented Interfaces:
ClusterEvent
- Enclosing interface:
ClusterEvent
public static record ClusterEvent.Presence(String originNodeId, String action, String entityType, String entityName, String id, String userId, String displayName, String avatarUrl)
extends Record
implements ClusterEvent
A user-presence notice for record-level collaboration markers: one user has entered, refreshed, or
left the live view of a specific record. Receivers mirror the
(entityType, entityName, id)
record's viewer set into their own presence registry so a viewer on any node sees who else is here.
It carries no timestamp: a receiver stamps lastSeen from its own clock on receipt, so a
stale entry expires by local TTL without depending on cross-node clock agreement. ENTER and
HEARTBEAT are both an upsert (refresh the viewer); LEAVE removes them. Like every
event on this bus it is best-effort — a missed ping self-heals on the next heartbeat or by TTL.
-
Nested Class Summary
Nested classes/interfaces inherited from interface su.onno.cluster.ClusterEvent
ClusterEvent.EntityChanged, ClusterEvent.Notification, ClusterEvent.Presence, ClusterEvent.ProcessTasksChanged -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringA user opened the record's live view.static final StringA periodic liveness refresh from a user still on the record.static final StringA user left the record's live view.Fields inherited from interface su.onno.cluster.ClusterEvent
KIND_ENTITY_CHANGED, KIND_NOTIFICATION, KIND_PRESENCE, KIND_PROCESS_TASKS_CHANGED -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaction()Returns the value of theactionrecord component.Returns the value of theavatarUrlrecord component.Returns the value of thedisplayNamerecord component.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()The payload-shape tag identifying which permitted variant this event is.Returns the value of theoriginNodeIdrecord component.final StringtoString()Returns a string representation of this record class.userId()Returns the value of theuserIdrecord component.withOrigin(String originNodeId) A copy of this event withClusterEvent.originNodeId()set — used by a bus to stamp its identity on send.
-
Field Details
-
ENTER
A user opened the record's live view. Treated as an upsert by the registry.- See Also:
-
HEARTBEAT
A periodic liveness refresh from a user still on the record. Treated as an upsert.- See Also:
-
LEAVE
A user left the record's live view. Removes them from the registry.- See Also:
-
-
Constructor Details
-
Presence
public Presence(String originNodeId, String action, String entityType, String entityName, String id, String userId, String displayName, String avatarUrl) Creates an instance of aPresencerecord class.- Parameters:
originNodeId- the value for theoriginNodeIdrecord componentaction- the value for theactionrecord componententityType- the value for theentityTyperecord componententityName- the value for theentityNamerecord componentid- the value for theidrecord componentuserId- the value for theuserIdrecord componentdisplayName- the value for thedisplayNamerecord componentavatarUrl- the value for theavatarUrlrecord component
-
-
Method Details
-
kind
Description copied from interface:ClusterEventThe payload-shape tag identifying which permitted variant this event is.- Specified by:
kindin interfaceClusterEvent
-
withOrigin
Description copied from interface:ClusterEventA copy of this event withClusterEvent.originNodeId()set — used by a bus to stamp its identity on send.- Specified by:
withOriginin interfaceClusterEvent
-
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). -
originNodeId
Returns the value of theoriginNodeIdrecord component.- Specified by:
originNodeIdin interfaceClusterEvent- Returns:
- the value of the
originNodeIdrecord component
-
action
Returns the value of theactionrecord component.- Returns:
- the value of the
actionrecord 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
-
userId
Returns the value of theuserIdrecord component.- Returns:
- the value of the
userIdrecord component
-
displayName
Returns the value of thedisplayNamerecord component.- Returns:
- the value of the
displayNamerecord component
-
avatarUrl
Returns the value of theavatarUrlrecord component.- Returns:
- the value of the
avatarUrlrecord component
-