Skip to main content

Java Rest API Architecture

Spring Boot Rest API Architecture

The diagram below represents the architecture used in the project.

Project architecture CQRS

Upon successful execution of a database update, the microservice publishes one or more events describing how the persistence state has changed e.g. if a “Create Category” event is successful, then a “Menu Updated” event and a “Category Created” event will be published.

Application Events contain the following basic information:

Event AttributeDescription
idUnique id of the event instance (format: uuid)
eventCodeCode identifying the type of event
correlationIdTransaction identifier. This attribute is also returned as a response header if the command was received via the REST API and can also be found in all log entries relating to the transaction. CorrelationID can either be supplied by the input event/request or generated when not supplied.
operationCodeCode identifying the operation which generated the event
creationDateWhen the event was created
Custom Attribute(s)e.g. menuId