public class AggregateEventTag$ extends Object
Modifier and Type | Field and Description |
---|---|
static AggregateEventTag$ |
MODULE$
Static reference to the singleton instance of this Scala object.
|
Constructor and Description |
---|
AggregateEventTag$() |
Modifier and Type | Method and Description |
---|---|
<Event extends AggregateEvent<Event>> |
of(Class<Event> eventType)
Convenience factory method of
AggregateEventTag that uses the
class name of the event type as tag . |
<Event extends AggregateEvent<Event>> |
of(Class<Event> eventType,
String tag)
Factory method of
AggregateEventTag . |
int |
selectShard(int numShards,
String entityId)
Select a shard given the number of shards and the ID of the entity.
|
<Event extends AggregateEvent<Event>> |
sharded(Class<Event> eventType,
int numShards)
Create an aggregate event shards tagger.
|
<Event extends AggregateEvent<Event>> |
sharded(Class<Event> eventType,
String baseTagName,
int numShards)
Create a sharded aggregate event tag.
|
String |
shardTag(String baseTagName,
int shardNo)
Generate a shard tag according to the base tag name and the shard number.
|
public static final AggregateEventTag$ MODULE$
public <Event extends AggregateEvent<Event>> AggregateEventTag<Event> of(Class<Event> eventType)
AggregateEventTag
that uses the
class name of the event type as tag
. Note that it is needed to
retain the original tag when the class name is changed because
the tag is part of the store event data.public <Event extends AggregateEvent<Event>> AggregateEventTag<Event> of(Class<Event> eventType, String tag)
AggregateEventTag
.public <Event extends AggregateEvent<Event>> AggregateEventShards<Event> sharded(Class<Event> eventType, int numShards)
This is a convenience function that uses the name of the class as the tag name. Note that if the class name changes, the tag name must be retained, and so this method will no longer be suitable for use.
Events that return this will be tagged with a tag that is based on a hash of the events persistence ID, modulo the number of shards.
The numShards
should be selected up front, and shouldn't change. If it does change, events for the
same entity will be produced by different event streams and handled by different shards in the read side
processor, leading to out of order event handling.
eventType
- The type of the event.numShards
- The number of shards.public <Event extends AggregateEvent<Event>> AggregateEventShards<Event> sharded(Class<Event> eventType, String baseTagName, int numShards)
Events that return this will be tagged with a tag that is based on a hash of the events persistence ID, modulo the number of shards.
The numShards
should be selected up front, and shouldn't change. If it does change, events for the
same entity will be produced by different event streams and handled by different shards in the read side
processor, leading to out of order event handling.
eventType
- The type of the event.baseTagName
- The base name for the tag, this will be combined with the shard number to form the tag name.numShards
- The number of shards.public int selectShard(int numShards, String entityId)
numShards
- The number of shards.entityId
- The ID of the entity.