Class CustomerAggregate

java.lang.Object
com.brodygaudel.bank.command.aggregate.CustomerAggregate

public class CustomerAggregate extends Object
Aggregate representing a customer in the system.

This aggregate captures the state changes of a customer, including creation, update, and deletion events. It applies the events and updates its internal state accordingly.

  • Constructor Details

    • CustomerAggregate

      public CustomerAggregate()
      Default constructor for the CustomerAggregate.
    • CustomerAggregate

      @CommandHandler public CustomerAggregate(@NotNull @NotNull CreateCustomerCommand command)
      Constructor for handling the CreateCustomerCommand and applying the corresponding event.
      Parameters:
      command - The CreateCustomerCommand to handle.
  • Method Details

    • on

      @EventSourcingHandler public void on(@NotNull @NotNull CustomerCreatedEvent event)
      Event sourcing handler for the CustomerCreatedEvent.
      Parameters:
      event - The CustomerCreatedEvent to handle.
    • handle

      @CommandHandler public void handle(@NotNull @NotNull UpdateCustomerCommand command)
      Command handler for handling the UpdateCustomerCommand and applying the corresponding event.
      Parameters:
      command - The UpdateCustomerCommand to handle.
    • on

      @EventSourcingHandler public void on(@NotNull @NotNull CustomerUpdatedEvent event)
      Event sourcing handler for the CustomerUpdatedEvent.
      Parameters:
      event - The CustomerUpdatedEvent to handle.
    • handle

      @CommandHandler public void handle(@NotNull @NotNull DeleteCustomerCommand command)
      Command handler for handling the DeleteCustomerCommand and applying the corresponding event.
      Parameters:
      command - The DeleteCustomerCommand to handle.
    • on

      @EventSourcingHandler public void on(@NotNull @NotNull CustomerDeletedEvent event)
      Event sourcing handler for the CustomerDeletedEvent.
      Parameters:
      event - The CustomerDeletedEvent to handle.