Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/microservices-patterns/ftgo-application/llms.txt

Use this file to discover all available pages before exploring further.

The Restaurant Service in the FTGO application manages the restaurants that list their menus on the platform. It stores each restaurant’s profile and menu, exposes a REST API for registration and lookup, and publishes domain events that allow other services — including the Order Service, Kitchen Service, and Delivery Service — to replicate restaurant data locally. This page covers the service’s responsibilities, domain model, REST API, messaging, and database schema.

Responsibilities

  • Register new restaurants with a name, address, and menu
  • Persist restaurant data as Restaurant aggregates in MySQL
  • Publish a RestaurantCreated event so downstream services can build their own local replicas
  • Publish a RestaurantMenuRevised event when a menu is updated
  • Expose a read endpoint for restaurant lookups

Domain Model

The core entity is Restaurant, persisted to the restaurants table.
FieldTypeNotes
idLongAuto-generated primary key
nameStringDisplay name of the restaurant
menuRestaurantMenuEmbedded; contains a list of MenuItem objects
RestaurantMenu is an embedded value object containing the collection of MenuItem entries. Each MenuItem has a menu item ID, name, and price. The RestaurantService.create() method saves the aggregate and immediately publishes a RestaurantCreated event, ensuring downstream consumers receive the full menu at creation time.
The Restaurant Service does not itself participate in sagas — it is a source-of-truth publisher. The Order Service, Kitchen Service, and Delivery Service each maintain their own local read replicas of restaurant data by consuming RestaurantCreated events.

REST API

The service listens on port 8084. All endpoints are under the /restaurants path.
MethodPathDescription
POST/restaurantsRegister a new restaurant; returns { id }
GET/restaurants/{restaurantId}Retrieve restaurant name and ID. Returns 404 if not found.

Create restaurant request body

{
  "name": "Ajisen Ramen",
  "address": {
    "street1": "1 Main St",
    "city": "Oakland",
    "state": "CA",
    "zip": "94612"
  },
  "menu": {
    "menuItems": [
      { "id": "kl", "name": "Karaage Lunch", "price": "12.99" }
    ]
  }
}

Get restaurant response body

{
  "id": 1,
  "name": "Ajisen Ramen"
}

Messaging

Events published

The RestaurantDomainEventPublisher emits events on the net.chrisrichardson.ftgo.restaurantservice.domain.Restaurant channel:
EventTriggerConsumers
RestaurantCreatedNew restaurant created via POST /restaurants; includes name, address, and full menuOrder Service, Kitchen Service, Delivery Service
RestaurantMenuRevisedMenu is updated; includes revised menu itemsOrder Service
The RestaurantCreated event carries the restaurant’s Address, which the Delivery Service uses to populate its own restaurant pickup address table.

Commands handled

The Restaurant Service does not handle any saga commands. It is a pure event publisher in the FTGO messaging topology.

Database

The Restaurant Service uses MySQL. Key tables:
TableDescription
restaurantsThe Restaurant aggregate: ID, name, and embedded menu
Menu items are stored as an @ElementCollection embedded within the restaurant row, or as a collection table depending on the JPA mapping in RestaurantMenu. Transactional outbox messages for published events are written to the Eventuate Tram message table and relayed by the CDC service.

Build docs developers (and LLMs) love