Commit a275ea9d authored by Deep Bhuller's avatar Deep Bhuller

Merge branch 'inventory-update-producer' into 'dev'

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

See merge request !12
parents 25c865d7 2632c247
Pipeline #1672 failed with stage
in 38 seconds
...@@ -18,4 +18,9 @@ public class KafkaController { ...@@ -18,4 +18,9 @@ public class KafkaController {
public void sendMessageToKafkaTopic(@RequestParam String id) { public void sendMessageToKafkaTopic(@RequestParam String id) {
producer.sendOrderId(id); producer.sendOrderId(id);
} }
@PostMapping(value = "/inventory/{quantity}")
public void sendInventoryQuantity(@PathVariable String quantity) {
producer.sendInventoryQuantity(quantity);
}
} }
...@@ -20,4 +20,9 @@ public class Consumer { ...@@ -20,4 +20,9 @@ public class Consumer {
public void getOrderStatusFromWarehouse(String status) { public void getOrderStatusFromWarehouse(String status) {
logger.info(String.format("#### -> Consumed order Status: %s", 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 { ...@@ -18,6 +18,7 @@ public class Producer {
private static final Logger logger = LoggerFactory.getLogger(Producer.class); private static final Logger logger = LoggerFactory.getLogger(Producer.class);
private static final String MANAGER_TOPIC = "managers"; private static final String MANAGER_TOPIC = "managers";
private static final String ORDER_TOPIC = "orders"; private static final String ORDER_TOPIC = "orders";
private static final String INVENTORY_TOPIC = "inventory";
private KafkaTemplate<String, String> kafkaTemplate; private KafkaTemplate<String, String> kafkaTemplate;
...@@ -45,4 +46,9 @@ public class Producer { ...@@ -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