updating scs-100 tutorial
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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()));
|
||||
}
|
||||
|
||||
|
||||
@@ -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");
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user