Class AggregateClient<T>

java.lang.Object
io.serialized.client.aggregate.AggregateClient<T>

public class AggregateClient<T>
extends Object
  • Method Details

    • aggregateClient

      public static <T> AggregateClient.Builder<T> aggregateClient​(String aggregateType, Class<T> stateClass, SerializedClientConfig config)
    • save

      public void save​(AggregateRequest request)
      Save or append events to an aggregate according to the given request
      Parameters:
      request - the request to perform
    • update

      public void update​(String aggregateId, AggregateUpdate<T> update)
      Update the aggregate.

      The update will be performed using optimistic concurrency check depending on the useOptimisticConcurrencyOnUpdate configuration flag.

      Parameters:
      aggregateId - The ID of the aggregate.
      update - Function that executes business logic and returns the resulting domain events.
    • update

      public void update​(UUID aggregateId, AggregateUpdate<T> update)
      Update the aggregate.

      The update will be performed using optimistic concurrency check depending on the useOptimisticConcurrencyOnUpdate configuration flag.

      Parameters:
      aggregateId - The ID of the aggregate.
      update - Function that executes business logic and returns the resulting domain events.
    • update

      public void update​(UUID aggregateId, UUID tenantId, AggregateUpdate<T> update)
      Update the aggregate.

      The update will be performed using optimistic concurrency check depending on the useOptimisticConcurrencyOnUpdate configuration flag.

      Parameters:
      aggregateId - The ID of the aggregate.
      tenantId - The ID of the tenant.
      update - Function that executes business logic and returns the resulting domain events.
    • deleteByType

      public AggregateDelete<T> deleteByType()
    • deleteByType

      public AggregateDelete<T> deleteByType​(UUID tenantId)
    • deleteById

      public AggregateDelete<T> deleteById​(UUID aggregateId)
    • deleteById

      public AggregateDelete<T> deleteById​(UUID aggregateId, UUID tenantId)
    • exists

      public boolean exists​(UUID aggregateId)
      Check if an aggregate exists.
      Parameters:
      aggregateId - ID of aggregate to check.
      Returns:
      True if aggregate with ID exists, false if not.
    • exists

      public boolean exists​(UUID aggregateId, UUID tenantId)
      Check if an aggregate exists for the given tenant.
      Parameters:
      aggregateId - ID of aggregate to check.
      tenantId - ID of tenant.
      Returns:
      True if aggregate with ID exists, false if not.