public class AggregateClient<T> extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
AggregateClient.Builder<T> |
| Modifier and Type | Method and Description |
|---|---|
static <T> AggregateClient.Builder<T> |
aggregateClient(String aggregateType,
Class<T> stateClass,
SerializedClientConfig config) |
void |
append(String aggregateId,
List<Event> events)
Unconditionally append events to an aggregate.
|
void |
append(String aggregateId,
List<Event> events,
long expectedVersion)
Append events to an aggregate using optimistic concurrency.
|
void |
append(UUID aggregateId,
List<Event> events)
Unconditionally append events to an aggregate.
|
void |
append(UUID aggregateId,
List<Event> events,
long expectedVersion)
Append events to an aggregate using optimistic concurrency.
|
boolean |
exists(UUID aggregateId)
Check if an aggregate exists.
|
void |
save(String aggregateId,
List<Event> events)
Save events as a new aggregate.
|
void |
save(UUID aggregateId,
List<Event> events)
Save events as a new aggregate.
|
void |
update(String aggregateId,
AggregateUpdate<T> update)
Update the aggregate.
|
void |
update(UUID aggregateId,
AggregateUpdate<T> update)
Update the aggregate.
|
public static <T> AggregateClient.Builder<T> aggregateClient(String aggregateType, Class<T> stateClass, SerializedClientConfig config)
public void save(String aggregateId, List<Event> events)
The ID of the aggregate must be unique for the aggregate type.
aggregateId - The ID of the new aggregate.events - List of events to save.ConcurrencyException - if aggregate with the same ID already exists.public void save(UUID aggregateId, List<Event> events)
The ID of the aggregate must be unique for the aggregate type.
aggregateId - The ID of the new aggregate.events - List of events to save.ConcurrencyException - if aggregate with the same ID already exists.public void append(String aggregateId, List<Event> events)
aggregateId - The ID of the aggregate.events - List of events to save.public void append(UUID aggregateId, List<Event> events)
aggregateId - The ID of the aggregate.events - List of events to save.public void append(String aggregateId, List<Event> events, long expectedVersion)
aggregateId - The ID of the aggregate.events - List of events to save.expectedVersion - Expected existing aggregate version for the aggregate.public void append(UUID aggregateId, List<Event> events, long expectedVersion)
aggregateId - The ID of the aggregate.events - List of events to save.expectedVersion - Expected existing aggregate version for the aggregate.public void update(String aggregateId, AggregateUpdate<T> update)
The update will be performed using optimistic concurrency check depending on the
useOptimisticConcurrencyOnUpdate configuration flag.
aggregateId - The ID of the aggregate.update - Function that executes business logic and returns the resulting domain events.public void update(UUID aggregateId, AggregateUpdate<T> update)
The update will be performed using optimistic concurrency check depending on the
useOptimisticConcurrencyOnUpdate configuration flag.
aggregateId - The ID of the aggregate.update - Function that executes business logic and returns the resulting domain events.public boolean exists(UUID aggregateId)
Copyright © 2019. All rights reserved.