Record Class ClusterEvent.Notification

java.lang.Object
java.lang.Record
su.onno.cluster.ClusterEvent.Notification
Record Components:
originNodeId - the publishing node's id, or null before a bus stamps it.
recipientId - the target user's identity record id (or username for an unlinked login).
notificationId - the stored notification's id, so a receiver can de-duplicate against a refetch.
type - the notification type tag (mention/assignment/…), or null.
title - the short headline, or null when trimmed to fit the payload cap.
body - the longer text, or null when absent or trimmed.
link - the kind/name/id route the notification opens, or null.
actorName - who triggered it, for display, or null.
All Implemented Interfaces:
ClusterEvent
Enclosing interface:
ClusterEvent

public static record ClusterEvent.Notification(String originNodeId, String recipientId, String notificationId, String type, String title, String body, String link, String actorName) extends Record implements ClusterEvent
A per-user notification raised on one node whose recipient may be connected to another. Unlike ClusterEvent.EntityChanged/ClusterEvent.Presence, the durable copy already lives in the shared onno_notifications table, so the cross-node event exists only to wake the recipient's live streams on peer nodes: a receiver pushes it to any local SSE stream owned by recipientId. The richer fields ride along so a peer can paint the row without a refetch; if they were dropped to fit the payload cap only recipientId survives and the browser refetches.
  • Constructor Details

    • Notification

      public Notification(String originNodeId, String recipientId, String notificationId, String type, String title, String body, String link, String actorName)
      Creates an instance of a Notification record class.
      Parameters:
      originNodeId - the value for the originNodeId record component
      recipientId - the value for the recipientId record component
      notificationId - the value for the notificationId record component
      type - the value for the type record component
      title - the value for the title record component
      body - the value for the body record component
      link - the value for the link record component
      actorName - the value for the actorName record component
  • Method Details

    • kind

      public String kind()
      Description copied from interface: ClusterEvent
      The payload-shape tag identifying which permitted variant this event is.
      Specified by:
      kind in interface ClusterEvent
    • withOrigin

      public ClusterEvent.Notification withOrigin(String originNodeId)
      Description copied from interface: ClusterEvent
      A copy of this event with ClusterEvent.originNodeId() set — used by a bus to stamp its identity on send.
      Specified by:
      withOrigin in interface ClusterEvent
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • originNodeId

      public String originNodeId()
      Returns the value of the originNodeId record component.
      Specified by:
      originNodeId in interface ClusterEvent
      Returns:
      the value of the originNodeId record component
    • recipientId

      public String recipientId()
      Returns the value of the recipientId record component.
      Returns:
      the value of the recipientId record component
    • notificationId

      public String notificationId()
      Returns the value of the notificationId record component.
      Returns:
      the value of the notificationId record component
    • type

      public String type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • title

      public String title()
      Returns the value of the title record component.
      Returns:
      the value of the title record component
    • body

      public String body()
      Returns the value of the body record component.
      Returns:
      the value of the body record component
    • link

      public String link()
      Returns the value of the link record component.
      Returns:
      the value of the link record component
    • actorName

      public String actorName()
      Returns the value of the actorName record component.
      Returns:
      the value of the actorName record component