updating scs-100 tutorial

This commit is contained in:
Jay Ehsaniara
2021-06-15 22:34:39 -07:00
parent 6604387604
commit 14ac4b54e3
4 changed files with 5 additions and 4 deletions

View File

@@ -35,7 +35,7 @@ or give the full path)
java -jar scs-100-0.0.1-SNAPSHOT.jar
```
the application starts to listen on port 8080. make sure that port is not occupied by any other app already, if is try
the application starts to listen on port 8080. make sure that port not being occupied by any other app already, if is try
to pass the following parameter before `-jar` by adding `-Dserver.port=8081` as:
```shell

View File

@@ -74,9 +74,10 @@ public class OrderService {
// just a simulation of create exception for random orders (1 in 2) in case of inventory insufficiency
if (System.currentTimeMillis() % 2 == 0) {
orderIn.setOrderStatus(OrderStatus.INSUFFICIENT_INVENTORY);
orderIn.setOrderStatus(OrderStatus.OUT_OF_STOCK);
orderDataBase.put(orderIn.getOrderUuid(), orderIn);
log.warn("Let's assume we ran out of stock for item: {}", orderIn.getItemName());
Thread.sleep(5_000);//5 sec delay
throw new OrderFailedException(String.format("insufficient inventory for order: %s", orderIn.getOrderUuid()));
}

View File

@@ -6,7 +6,7 @@ import lombok.AllArgsConstructor;
public enum OrderStatus {
PENDING("PENDING"),
INVENTORY_CHECKING("INVENTORY_CHECKING"),
INSUFFICIENT_INVENTORY("INSUFFICIENT_INVENTORY"),
OUT_OF_STOCK("OUT_OF_STOCK"),
SHIPPED("SHIPPED"),
CANCELED("CANCELED");

View File

@@ -11,7 +11,7 @@ spring:
destination: scs-100.inventoryChecking
group: ${spring.application.name}-inventoryChecking-group
consumer:
maxAttempts: 1 # this example for simulating out of stock so there is no point of retrying after it failed in the first attempt
maxAttempts: 1 # on example we are simulating "out of stock" scenario, so there is no point for retrying after it failed in the first attempt
order-dlq:
destination: scs-100.ordering_dlq