Package akka.persistence.query.typed
Class EventEnvelope<Event>
- java.lang.Object
-
- akka.persistence.query.typed.EventEnvelope<Event>
-
public final class EventEnvelope<Event> extends java.lang.Object
Event wrapper adding meta data for the events in the result stream ofEventsBySliceQuery
query, or similar queries.If the
event
is not defined it has not been loaded yet. It can be loaded withLoadEventQuery
.The
timestamp
is the time the event was stored, in milliseconds since midnight, January 1, 1970 UTC (same asSystem.currentTimeMillis
).It is an improved
EventEnvelope
compared toEventEnvelope
.
-
-
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 APIjava.util.Optional<java.lang.Object>
getEventMetaData()
Java APIjava.util.Optional<Event>
getOptionalEvent()
Java APIjava.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
andslice
should be derived from thepersistenceId
, but must be explicitly defined when changing thepersistenceId
of the envelope.EventEnvelope<Event>
withTags(scala.collection.immutable.Set<java.lang.String> tags)
-
-
-
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)
-
-
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
andslice
should be derived from thepersistenceId
, but must be explicitly defined when changing thepersistenceId
of the envelope. Theslice
should be calculated withakka.persistence.Persistence.sliceForPersistenceId
for the givenpersistenceId
. TheentityType
should be extracted from thepersistenceId
withakka.persistence.typed.PersistenceId.extractEntityType
.
-
withEvent
public EventEnvelope<Event> withEvent(Event event)
-
withEventOption
public EventEnvelope<Event> withEventOption(scala.Option<Event> eventOption)
-
withTags
public EventEnvelope<Event> withTags(scala.collection.immutable.Set<java.lang.String> tags)
-
withMetadata
public EventEnvelope<Event> withMetadata(java.lang.Object metadata)
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-