Class EventEnvelope<Event>


  • public final class EventEnvelope<Event>
    extends java.lang.Object
    Event wrapper adding meta data for the events in the result stream of EventsBySliceQuery query, or similar queries.

    If the event is not defined it has not been loaded yet. It can be loaded with LoadEventQuery.

    The timestamp is the time the event was stored, in milliseconds since midnight, January 1, 1970 UTC (same as System.currentTimeMillis).

    It is an improved EventEnvelope compared to EventEnvelope.

    • Constructor Summary

      Constructors 
      Constructor Description
      EventEnvelope​(Offset offset, java.lang.String persistenceId, long sequenceNr, scala.Option<Event> eventOption, long timestamp, scala.Option<java.lang.Object> eventMetadata, java.lang.String entityType, int slice)  
      EventEnvelope​(Offset offset, java.lang.String persistenceId, long sequenceNr, scala.Option<Event> eventOption, long timestamp, scala.Option<java.lang.Object> eventMetadata, java.lang.String entityType, int slice, boolean filtered, java.lang.String source)  
      EventEnvelope​(Offset offset, java.lang.String persistenceId, long sequenceNr, scala.Option<Event> eventOption, long timestamp, scala.Option<java.lang.Object> eventMetadata, java.lang.String entityType, int slice, boolean filtered, java.lang.String source, scala.collection.immutable.Set<java.lang.String> tags)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static <Event> EventEnvelope<Event> apply​(Offset offset, java.lang.String persistenceId, long sequenceNr, Event event, long timestamp, java.lang.String entityType, int slice)  
      static <Event> EventEnvelope<Event> apply​(Offset offset, java.lang.String persistenceId, long sequenceNr, Event event, long timestamp, java.lang.String entityType, int slice, boolean filtered, java.lang.String source)  
      static <Event> EventEnvelope<Event> apply​(Offset offset, java.lang.String persistenceId, long sequenceNr, Event event, long timestamp, java.lang.String entityType, int slice, boolean filtered, java.lang.String source, scala.collection.immutable.Set<java.lang.String> tags)  
      static <Event> EventEnvelope<Event> create​(Offset offset, java.lang.String persistenceId, long sequenceNr, Event event, long timestamp, java.lang.String entityType, int slice)  
      static <Event> EventEnvelope<Event> create​(Offset offset, java.lang.String persistenceId, long sequenceNr, Event event, long timestamp, java.lang.String entityType, int slice, boolean filtered, java.lang.String source)  
      static <Event> EventEnvelope<Event> create​(Offset offset, java.lang.String persistenceId, long sequenceNr, Event event, long timestamp, java.lang.String entityType, int slice, boolean filtered, java.lang.String source, java.util.Set<java.lang.String> tags)  
      java.lang.String entityType()  
      boolean equals​(java.lang.Object obj)  
      Event event()  
      scala.Option<java.lang.Object> eventMetadata()  
      scala.Option<Event> eventOption()  
      boolean filtered()  
      Event getEvent()
      Java API
      java.util.Optional<java.lang.Object> getEventMetaData()
      Java API
      java.util.Optional<Event> getOptionalEvent()
      Java API
      java.util.Set<java.lang.String> getTags()
      Java API:
      int hashCode()  
      Offset offset()  
      java.lang.String persistenceId()  
      long sequenceNr()  
      int slice()  
      java.lang.String source()  
      scala.collection.immutable.Set<java.lang.String> tags()  
      long timestamp()  
      java.lang.String toString()  
      static <Event> scala.Option<scala.Tuple5<Offset,​java.lang.String,​java.lang.Object,​scala.Option<Event>,​java.lang.Object>> unapply​(EventEnvelope<Event> arg)  
      EventEnvelope<Event> withEvent​(Event event)  
      EventEnvelope<Event> withEventOption​(scala.Option<Event> eventOption)  
      EventEnvelope<Event> withMetadata​(java.lang.Object metadata)  
      EventEnvelope<Event> withPersistenceId​(java.lang.String persistenceId, java.lang.String entityType, int slice)
      entityType and slice should be derived from the persistenceId, but must be explicitly defined when changing the persistenceId of the envelope.
      EventEnvelope<Event> withTags​(scala.collection.immutable.Set<java.lang.String> tags)  
      • Methods inherited from class java.lang.Object

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

      • EventEnvelope

        public EventEnvelope​(Offset offset,
                             java.lang.String persistenceId,
                             long sequenceNr,
                             scala.Option<Event> eventOption,
                             long timestamp,
                             scala.Option<java.lang.Object> eventMetadata,
                             java.lang.String entityType,
                             int slice,
                             boolean filtered,
                             java.lang.String source,
                             scala.collection.immutable.Set<java.lang.String> tags)
      • EventEnvelope

        public EventEnvelope​(Offset offset,
                             java.lang.String persistenceId,
                             long sequenceNr,
                             scala.Option<Event> eventOption,
                             long timestamp,
                             scala.Option<java.lang.Object> eventMetadata,
                             java.lang.String entityType,
                             int slice,
                             boolean filtered,
                             java.lang.String source)
      • EventEnvelope

        public EventEnvelope​(Offset offset,
                             java.lang.String persistenceId,
                             long sequenceNr,
                             scala.Option<Event> eventOption,
                             long timestamp,
                             scala.Option<java.lang.Object> eventMetadata,
                             java.lang.String entityType,
                             int slice)
    • Method Detail

      • apply

        public static <Event> EventEnvelope<Event> apply​(Offset offset,
                                                         java.lang.String persistenceId,
                                                         long sequenceNr,
                                                         Event event,
                                                         long timestamp,
                                                         java.lang.String entityType,
                                                         int slice,
                                                         boolean filtered,
                                                         java.lang.String source,
                                                         scala.collection.immutable.Set<java.lang.String> tags)
      • apply

        public static <Event> EventEnvelope<Event> apply​(Offset offset,
                                                         java.lang.String persistenceId,
                                                         long sequenceNr,
                                                         Event event,
                                                         long timestamp,
                                                         java.lang.String entityType,
                                                         int slice,
                                                         boolean filtered,
                                                         java.lang.String source)
      • apply

        public static <Event> EventEnvelope<Event> apply​(Offset offset,
                                                         java.lang.String persistenceId,
                                                         long sequenceNr,
                                                         Event event,
                                                         long timestamp,
                                                         java.lang.String entityType,
                                                         int slice)
      • create

        public static <Event> EventEnvelope<Event> create​(Offset offset,
                                                          java.lang.String persistenceId,
                                                          long sequenceNr,
                                                          Event event,
                                                          long timestamp,
                                                          java.lang.String entityType,
                                                          int slice,
                                                          boolean filtered,
                                                          java.lang.String source,
                                                          java.util.Set<java.lang.String> tags)
      • create

        public static <Event> EventEnvelope<Event> create​(Offset offset,
                                                          java.lang.String persistenceId,
                                                          long sequenceNr,
                                                          Event event,
                                                          long timestamp,
                                                          java.lang.String entityType,
                                                          int slice,
                                                          boolean filtered,
                                                          java.lang.String source)
      • create

        public static <Event> EventEnvelope<Event> create​(Offset offset,
                                                          java.lang.String persistenceId,
                                                          long sequenceNr,
                                                          Event event,
                                                          long timestamp,
                                                          java.lang.String entityType,
                                                          int slice)
      • unapply

        public static <Event> scala.Option<scala.Tuple5<Offset,​java.lang.String,​java.lang.Object,​scala.Option<Event>,​java.lang.Object>> unapply​(EventEnvelope<Event> arg)
      • offset

        public Offset offset()
      • persistenceId

        public java.lang.String persistenceId()
      • sequenceNr

        public long sequenceNr()
      • eventOption

        public scala.Option<Event> eventOption()
      • timestamp

        public long timestamp()
      • eventMetadata

        public scala.Option<java.lang.Object> eventMetadata()
      • entityType

        public java.lang.String entityType()
      • slice

        public int slice()
      • filtered

        public boolean filtered()
      • source

        public java.lang.String source()
      • tags

        public scala.collection.immutable.Set<java.lang.String> tags()
      • event

        public Event event()
      • getEvent

        public Event getEvent()
        Java API
      • getOptionalEvent

        public java.util.Optional<Event> getOptionalEvent()
        Java API
      • getEventMetaData

        public java.util.Optional<java.lang.Object> getEventMetaData()
        Java API
      • getTags

        public java.util.Set<java.lang.String> getTags()
        Java API:
      • withPersistenceId

        public EventEnvelope<Event> withPersistenceId​(java.lang.String persistenceId,
                                                      java.lang.String entityType,
                                                      int slice)
        entityType and slice should be derived from the persistenceId, but must be explicitly defined when changing the persistenceId of the envelope. The slice should be calculated with akka.persistence.Persistence.sliceForPersistenceId for the given persistenceId. The entityType should be extracted from the persistenceId with akka.persistence.typed.PersistenceId.extractEntityType.
      • withTags

        public EventEnvelope<Event> withTags​(scala.collection.immutable.Set<java.lang.String> tags)
      • 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