Commit 2632c247 authored by dbhuller's avatar dbhuller

[AFP-37] adding functionality for inventory quantity update producer [@dbhuller]

parent 4bf9070a
Pipeline #1671 failed with stage
in 38 seconds
......@@ -18,4 +18,9 @@ public class KafkaController {
public void sendMessageToKafkaTopic(@RequestParam String id) {
producer.sendOrderId(id);
}
@PostMapping(value = "/inventory/{quantity}")
public void sendInventoryQuantity(@PathVariable String quantity) {
producer.sendInventoryQuantity(quantity);
}
}
......@@ -20,4 +20,9 @@ public class Consumer {
public void getOrderStatusFromWarehouse(String status) {
logger.info(String.format("#### -> Consumed order Status: %s", status));
}
@KafkaListener(topics = "inventory")
public void getInventoryQuantityUpdate(String quantity) {
logger.info(String.format("#### -> Consume inventory quantity update: %s", quantity));
}
}
......@@ -18,6 +18,7 @@ public class Producer {
private static final Logger logger = LoggerFactory.getLogger(Producer.class);
private static final String MANAGER_TOPIC = "managers";
private static final String ORDER_TOPIC = "orders";
private static final String INVENTORY_TOPIC = "inventory";
private KafkaTemplate<String, String> kafkaTemplate;
......@@ -45,4 +46,9 @@ public class Producer {
}
public void sendInventoryQuantity(String quantity) {
logger.info(String.format("#### -> Sending inventory quantity update: %s", quantity));
kafkaTemplate.send(INVENTORY_TOPIC, quantity);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment