Class Event<T>


  • public class Event<T>
    extends java.lang.Object
    The common event model class. This is used to provide a generic, and standard, approach to submitting events to a message broker. Serves as a wrapper around any generic object instance which can be customized to provide additional information for the specific event.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
        Event()  
      protected Event​(T payload, EventHeaders headers, java.lang.String id, java.lang.String type, java.lang.String payloadType, java.lang.String user, java.util.Date timeStamp)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      EventHeaders getHeaders()
      Returns the collection of headers associated with the event
      java.lang.String getId()
      Returns the unique identifier of the event
      T getPayload()
      The customized event payload.
      java.lang.String getPayloadAsString()
      Returns the event's payload in a JSON string format.
      java.lang.String getPayloadType()
      Returns the type of the payload
      java.util.Date getTimeStamp()
      Represents the exact time when the event took place.
      java.lang.String getType()
      The specific type of event.
      java.lang.String getUser()
      The name of the user associated with the event.
      int getVersion()
      Returns the version of the event model
      int hashCode()  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Event

        public Event()
      • Event

        protected Event​(T payload,
                        EventHeaders headers,
                        java.lang.String id,
                        java.lang.String type,
                        java.lang.String payloadType,
                        java.lang.String user,
                        java.util.Date timeStamp)
    • Method Detail

      • getVersion

        public int getVersion()
        Returns the version of the event model
        Returns:
        version
      • getId

        public java.lang.String getId()
        Returns the unique identifier of the event
        Returns:
        id
      • getUser

        public java.lang.String getUser()
        The name of the user associated with the event.

        This value may differ depending on the context. For example, this may represent the actual user currently authenticated within the system, or it may represent a system wide user that is executing an operation on behalf of someone.

        Returns:
        user name
      • getTimeStamp

        public java.util.Date getTimeStamp()
        Represents the exact time when the event took place. This may be equivalent to the current time (i.e. when the event is published) or a specific time that occurred in the past.
        Returns:
        time stamp
      • getType

        public java.lang.String getType()
        The specific type of event.
        Returns:
        event type
      • getPayloadType

        public java.lang.String getPayloadType()
        Returns the type of the payload
        Returns:
        payload type
      • getHeaders

        public EventHeaders getHeaders()
        Returns the collection of headers associated with the event
        Returns:
        headers
      • getPayload

        public T getPayload()
        The customized event payload.
        Returns:
        data
      • getPayloadAsString

        public java.lang.String getPayloadAsString()
                                            throws com.fasterxml.jackson.core.JsonProcessingException
        Returns the event's payload in a JSON string format.
        Returns:
        payload
        Throws:
        com.fasterxml.jackson.core.JsonProcessingException - when the event payload fails to serialize to json properly
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object