You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: step-2-exploring-the-app.md
+14-13Lines changed: 14 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -7,11 +7,11 @@ but also relies on an existing API we have [introduced in a previous post](https
7
7

8
8
9
9
The `Order Service` application has been designed around 5 main components that are directly mapped on Spring Boot components and classes:
10
-
* The `OrderController` (in package `org.acme.order.api`) is responsible for exposing an `Order API` to the outer world.
11
-
* The `OrderService` (in package `org.acme.order.service`) is responsible for implementing the business logic around the creation of orders.
12
-
* The `PastryAPIClient` (in package `org.acme.order.client`) is responsible for calling the `Pastry API` in *Product Domain* and get details or list of pastries.
13
-
* The `OrderEventPublisher` (in package `org.acme.order.service`) is responsible for publishing a message on a `Kafka` topic when a new `Order` is created.
14
-
* The `OrderEventListener` (in package `org.acme.order.service`) is responsible for consuming message on a `Kafka` topic when an `Order` has been reviewed.
10
+
* The [`OrderController`](src/main/java/org/acme/order/api/OrderController.java) (in package `org.acme.order.api`) is responsible for exposing an `Order API` to the outer world.
11
+
* The [`OrderService`](src/main/java/org/acme/order/service/OrderService.java) is responsible for implementing the business logic around the creation of orders.
12
+
* The [`PastryAPIClient`](src/main/java/org/acme/order/client/PastryAPIClient.java) is responsible for calling the `Pastry API` in *Product Domain* and get details or list of pastries.
13
+
* The [`OrderEventPublisher`](src/main/java/org/acme/order/service/OrderEventPublisher.java) is responsible for publishing a message on a `Kafka` topic when a new `Order` is created.
14
+
* The [`OrderEventListener`](src/main/java/org/acme/order/service/OrderEventListener.java) is responsible for consuming message on a `Kafka` topic when an `Order` has been reviewed.
15
15
16
16

17
17
@@ -21,23 +21,24 @@ dependencies (like a `Payment Service`, a `Customer Service`, a `Shipping Servic
21
21
22
22
However, this situation is complex enough to highlight the two problems we're addressing:
23
23
1) How to **efficiently set up a development environment** that depends on third-party API like the Pastry API?
24
-
You certainly want to avoid cloning this component repository, figuring out how to launch it and configure it accordingly. As a developer, developing your own mock of this service makes you also lose time and risk drifting from initial intent,
24
+
- You certainly want to avoid cloning this component repository and trying to figure out how to launch and configure it accordingly.
25
+
- As a developer, developing your own mock of this service makes you also lose time and risk drifting from initial intent,
25
26
2) How to **efficiently validate the conformance** of the `Order API` and `Order Events` against business expectations and API contracts?
26
-
Besides the core business logic, you might want to validate the network and protocol serialization layers as well as the respect of semantics.
27
+
-Besides the core business logic, you might want to validate the network and protocol serialization layers as well as the respect of semantics.
27
28
28
29
## Business logic
29
30
30
31
This application must implement basic flows:
31
-
* When creating a new `Order`, the service must check that the products are available before creating and persisting an order. Otherwise, order cannot be placed.
32
-
* When the `Order` is actually created, the service must also publish an `OrderEvent` to a specific Kafka topic to propagate this information to other systems that will review the events,
33
-
* When the `OrderEvent` has been reviewed, a new message is published on another `Kafka` topic. The `OrderEventListener` must capture-it and update the corresponding `Order` status using the service.
32
+
* When creating a new [`Order`](src/main/java/org/acme/order/service/model/Order.java), the service must check that the products are available before creating and persisting an order. Otherwise, order cannot be placed.
33
+
* When the [`Order`](src/main/java/org/acme/order/service/model/Order.java) is actually created, the service must also publish an [`OrderEvent`](src/main/java/org/acme/order/service/model/OrderEvent.java) to a specific Kafka topic to propagate this information to other systems that will review the events,
34
+
* When the [`OrderEvent`](src/main/java/org/acme/order/service/model/OrderEvent.java) has been reviewed, a new message is published on another `Kafka` topic. The [`OrderEventListener`](src/main/java/org/acme/order/service/OrderEventListener.java) must capture-it and update the corresponding [`Order`](src/main/java/org/acme/order/service/model/Order.java) status using the service.
34
35
35
36
## Flows specifications
36
37
37
38
All the interactions are specified using API contracts:
38
-
* The Order API is specified using the `src/main/resources/order-service-openapi.yaml` OpenAPI specification,
39
-
* The Pastry API is specified using the `src/test/resources/third-parties/apipastries-openapi.yaml` OpenAPI specification,
40
-
* The Order Events are specified using the `src/main/resources/order-events-asyncapi.yaml` AsyncAPI specification.
39
+
* The Order API is specified using the [`order-service-openapi.yaml`](src/main/resources/order-service-openapi.yaml) OpenAPI specification,
40
+
* The Pastry API is specified using the [`apipastries-openapi.yaml`](src/test/resources/third-parties/apipastries-openapi.yaml) OpenAPI specification,
41
+
* The Order Events are specified using the [`order-events-asyncapi.yaml`](src/main/resources/order-events-asyncapi.yaml) AsyncAPI specification.
41
42
42
43
Those specifications will help us for two things:
43
44
1) They will be used to provide simulations (or mocks) of third-parties systems - typically the Pastry API provider and the reviewer system that provides updates on `OrderEvents`
0 commit comments