Class CustomerEventHandlerService

java.lang.Object
com.brodygaudel.bank.query.service.customer.CustomerEventHandlerService

@Service @Transactional public class CustomerEventHandlerService extends Object
Service class for handling customer-related events, such as creation, update, and deletion.
  • Constructor Details

    • CustomerEventHandlerService

      public CustomerEventHandlerService(CustomerRepository customerRepository)
      Constructs a CustomerEventHandlerService with the specified CustomerRepository.
      Parameters:
      customerRepository - The repository for managing customer data.
  • Method Details

    • on

      @EventHandler public void on(@NotNull @NotNull CustomerCreatedEvent event)
      Handles the CustomerCreatedEvent by creating a new customer entity and saving it to the repository.
      Parameters:
      event - The CustomerCreatedEvent to handle.
    • on

      @EventHandler public void on(@NotNull @NotNull CustomerUpdatedEvent event)
      Handles the CustomerUpdatedEvent by updating an existing customer entity in the repository.
      Parameters:
      event - The CustomerUpdatedEvent to handle.
    • on

      @EventHandler public void on(@NotNull @NotNull CustomerDeletedEvent event)
      Handles the CustomerDeletedEvent by deleting an existing customer entity from the repository.
      Parameters:
      event - The CustomerDeletedEvent to handle.