How wenqiglantz/spring-boot-aws-eventbridge works
1. This repo contains two independent Spring Boot microservices: customer-service and order-service. They are built and deployed separately, each with its own pom.xml, Dockerfile, application config, database changelog, and source tree.
2. The main architectural style is event-driven pub/sub using AWS EventBridge. customer-service is the event publisher, and order-service is a subscriber/consumer. The README states that CustomerCreatedEvent is published to EventBridge, which then fans out to multiple targets.
3. The primary synchronous flow in customer-service is a standard layered REST app: CustomerController receives HTTP requests, delegates to CustomerService, which uses CustomerRepository and the JPA entity model under persistence/entity. That service also produces domain events from the customer lifecycle.
4. customer-service is organized around a customer domain with supporting DTOs and event payloads in data/. It has explicit event classes for create/update/delete, error models, and a NotFoundException for missing resources. This keeps API, persistence, and integration-event representations separate.
5. order-service has the same layered structure, but with an additional inbound integration boundary. Besides OrderController, it includes SubscriberController, which is the endpoint meant to receive EventBridge-delivered events, likely through API Gateway as described in the README.
6. On the subscriber side, order-service defines a richer event model: a common Event type plus CustomerCreatedEvent, CustomerUpdatedEvent, and CustomerDeletedEvent. This suggests the service can react to multiple customer-domain changes, not just creation events, and maintain a local projection or related state.
7. Both services persist data locally using Spring Data JPA with a Customer entity and CustomerRepository. Each service has Liquibase changelogs under src/main/resources/changelog, so schema evolution is versioned and applied at startup or deployment time.
8. There is explicit datasource truststore configuration in both services (DataSourceConfiguration and DataSourceTruststoreProperties), plus a postgre.jks file in each module. That indicates the database connection is configured with TLS/SSL trust material, which is an important infrastructure boundary in the deployment.
9. Error handling is centralized in each service with GeneralExceptionControllerAdvice, ErrorResponse, and ErrorType. This gives both the REST APIs and the subscriber endpoint consistent failure responses.
10. Each service exposes Swagger/OpenAPI configuration through SwaggerConfiguration, so the HTTP boundary is intended to be documented and inspectable. That matters for the REST-facing parts of both services, especially the consumer endpoint in order-service.
11. The repository is clearly designed for containerized deployment. Both modules have Dockerfiles and ignore files, and order-service also includes the Maven wrapper, suggesting independent build and runtime packaging for each microservice.
12. From an architecture-diagram perspective, the key data flow is: client requests enter customer-service, customer state is stored in its database, a customer event is emitted to EventBridge, EventBridge routes it to order-service via API Gateway, and order-service persists or updates its own local state in response. The Lambda mentioned in the README is an external demonstration target, not part of the code tree, but it reinforces the fan-out nature of the event bus.
Main entry points: OrderServiceImpl.java Order service impl · CustomerServiceImpl.java Customer service impl · OrderServiceApplication.java Order service · SubscriberController.java Subscriber API
Components 22
Repository
Top-level Spring Boot microservices with shared event-driven deployment model.
- spring-boot-aws-eventbridge · Repository containing two independently built Spring Boot microservices.
customer-service
Publisher microservice for customer CRUD and customer-domain events.
- Customer service · Publisher service for customer lifecycle and REST API.
customer-service/src/main/java/com/github/wenqiglantz/service/eventbridge/customerservice/CustomerServiceApplication.java - Customer API · HTTP boundary for customer CRUD operations.
customer-service/src/main/java/com/github/wenqiglantz/service/eventbridge/customerservice/restcontroller/CustomerController.java - Customer service impl · Coordinates customer use cases and event emission.
customer-service/src/main/java/com/github/wenqiglantz/service/eventbridge/customerservice/service/impl/CustomerServiceImpl.java - Customer repo · Persistence access for customer aggregates.
customer-service/src/main/java/com/github/wenqiglantz/service/eventbridge/customerservice/persistence/repository/CustomerRepository.java - Customer model · Local customer entity and persistence schema.
customer-service/src/main/java/com/github/wenqiglantz/service/eventbridge/customerservice/persistence/entity/Customer.java - Customer events · Customer-created, updated, and deleted event payloads plus DTOs.
customer-service/src/main/java/com/github/wenqiglantz/service/eventbridge/customerservice/data/event - DB config · JPA datasource and truststore wiring for secure database access.
customer-service/src/main/java/com/github/wenqiglantz/service/eventbridge/customerservice/config/DataSourceConfiguration.java - Liquibase · Versioned schema migrations for the customer database.
customer-service/src/main/resources/changelog/db.changelog-master.xml
order-service
Consumer microservice for orders plus customer event subscription.
- Order service · Consumer service for order APIs and customer-event projections.
order-service/src/main/java/com/github/wenqiglantz/service/eventbridge/orderservice/OrderServiceApplication.java - Order API · HTTP boundary for order-related operations.
order-service/src/main/java/com/github/wenqiglantz/service/eventbridge/orderservice/restcontroller/OrderController.java - Subscriber API · Inbound endpoint for EventBridge-delivered customer events.
order-service/src/main/java/com/github/wenqiglantz/service/eventbridge/orderservice/restcontroller/SubscriberController.java - Order service impl · Coordinates order use cases and local state updates from events.
order-service/src/main/java/com/github/wenqiglantz/service/eventbridge/orderservice/service/impl/OrderServiceImpl.java - Order repo · Persistence access for the order-service local model.
order-service/src/main/java/com/github/wenqiglantz/service/eventbridge/orderservice/persistence/repository/CustomerRepository.java - Order model · Local entity model persisted by the order service.
order-service/src/main/java/com/github/wenqiglantz/service/eventbridge/orderservice/persistence/entity/Customer.java - Event model · Shared event envelope plus customer-created, updated, and deleted payloads.
order-service/src/main/java/com/github/wenqiglantz/service/eventbridge/orderservice/data/event/Event.java - DB config · JPA datasource and truststore wiring for secure database access.
order-service/src/main/java/com/github/wenqiglantz/service/eventbridge/orderservice/config/DataSourceConfiguration.java - Liquibase · Versioned schema migrations for the order database.
order-service/src/main/resources/changelog/db.changelog-master.xml
External infra
Messaging, API ingress, and database infrastructure boundaries.
- EventBridge · Fan-out event bus for customer-domain integration events.
- API Gateway · Delivery boundary used to invoke the subscriber endpoint.
- Customer DB · Local persistent store for customer-service.
- Order DB · Local persistent store for order-service.
Connections 23
- spring-boot-aws-eventbridge → Customer service: contains · Repository includes the customer microservice module.
- spring-boot-aws-eventbridge → Order service: contains · Repository includes the order microservice module.
- Customer service → Customer API: exposes · Application serves customer REST endpoints.
- Customer API → Customer service impl: delegates · Controller forwards CRUD requests to the service layer.
- Customer service impl → Customer repo: persists via · Customer use cases read and write through the repository.
- Customer repo → Customer model: maps · Repository operates on the customer entity model.
- Customer service impl → Customer events: publishes · Customer lifecycle changes are emitted as events.
- Customer service impl → DB config: uses · Service runtime relies on datasource and truststore configuration.
- DB config → Customer DB: connects to · Datasource configuration targets the local customer database.
- Liquibase → Customer DB: migrates · Liquibase updates the customer schema.
- Customer events → EventBridge: publishes to · CustomerCreatedEvent and related events are sent to EventBridge.
- EventBridge → API Gateway: routes to · EventBridge fans out to the subscriber ingress path.
- API Gateway → Subscriber API: invokes · API Gateway delivers events to the order-service subscriber endpoint.
- Order service → Order API: exposes · Application serves order REST endpoints.
- Order service → Subscriber API: exposes · Application also exposes the event subscriber boundary.
- Subscriber API → Order service impl: delegates · Inbound events are handled by the order service layer.
- Order API → Order service impl: delegates · Order API requests flow into the service layer.
- Order service impl → Order repo: persists via · Order use cases read and write through the repository.
- Order repo → Order model: maps · Repository operates on the local entity model.
- Order service impl → Event model: consumes · Subscriber logic interprets customer-domain events.
- Order service impl → DB config: uses · Service runtime relies on datasource and truststore configuration.
- DB config → Order DB: connects to · Datasource configuration targets the local order database.
- Liquibase → Order DB: migrates · Liquibase updates the order schema.