updating README.md

This commit is contained in:
Jay Ehsaniara
2021-06-23 06:27:38 -07:00
parent 29d2aa2a80
commit bea8f7c211
2 changed files with 3 additions and 1 deletions

View File

@@ -55,3 +55,4 @@ you should now be able to place your order by calling the following `curl` comma
# assuming your app is listening on 8080
ORDER_UUID=$(curl --silent -H 'Content-Type: application/json' -d "{\"itemName\":\"book\"}" http://localhost:8080/order | jq -r '.orderUuid') && for i in `seq 1 15`; do echo $(curl --silent "http://localhost:8080/order/status/"$ORDER_UUID); sleep 1; done;
```
Note: make sure you have already installed the `jq`

View File

@@ -72,11 +72,12 @@ public class OrderService {
Thread.sleep(5_000);//5 sec delay
// just a simulation of create exception for random orders (1 in 2) in case of inventory insufficiency
// just to simulate an dummy exception for random order (1 in 2) [ inventory insufficiency ]
if (System.currentTimeMillis() % 2 == 0) {
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()));
}