Commit d9dc6cfe authored by Deep Bhuller's avatar Deep Bhuller

Merge branch 'AFP37-inventory-quantity-update' into 'dev'

[AFP-37]  Adding code to send order to topic for inventory service to consume [@dbhuller]

See merge request !42
parents 1eb52812 678d05f6
Pipeline #1737 failed with stage
in 39 seconds
...@@ -37,8 +37,9 @@ public class OrderController { ...@@ -37,8 +37,9 @@ public class OrderController {
@PostMapping("/orders") @PostMapping("/orders")
@ResponseStatus(HttpStatus.CREATED) @ResponseStatus(HttpStatus.CREATED)
public Mono<Order> getOrderFromEcom(@RequestBody Order orderObject) { public Mono<Order> getOrderFromEcom(@RequestBody Order orderObject) {
sender.sendOrderToWarehouse(orderObject); Mono<Order> orderCreated = orderService.createOrder(orderObject);
return orderService.createOrder(orderObject); sender.sendOrderToTopic(orderObject);
return orderCreated;
} }
......
...@@ -26,7 +26,7 @@ public class Sender { ...@@ -26,7 +26,7 @@ public class Sender {
private static final String ORDER_TOPIC = "orders"; private static final String ORDER_TOPIC = "orders";
public void sendOrderToWarehouse(Order orderObject) { public void sendOrderToTopic(Order orderObject) {
log.info(String.format("##### -> Sender sending message: %s ", orderObject)); log.info(String.format("##### -> Sender sending message: %s ", orderObject));
ProducerRecord<String, Order> record = new ProducerRecord<>(ORDER_TOPIC, orderObject); ProducerRecord<String, Order> record = new ProducerRecord<>(ORDER_TOPIC, orderObject);
System.out.println("In sendOrderToWarehouse"); System.out.println("In sendOrderToWarehouse");
......
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