Commit 678d05f6 authored by dbhuller's avatar dbhuller

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

parent 1eb52812
Pipeline #1736 failed with stage
in 40 seconds
......@@ -37,8 +37,9 @@ public class OrderController {
@PostMapping("/orders")
@ResponseStatus(HttpStatus.CREATED)
public Mono<Order> getOrderFromEcom(@RequestBody Order orderObject) {
sender.sendOrderToWarehouse(orderObject);
return orderService.createOrder(orderObject);
Mono<Order> orderCreated = orderService.createOrder(orderObject);
sender.sendOrderToTopic(orderObject);
return orderCreated;
}
......
......@@ -26,7 +26,7 @@ public class Sender {
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));
ProducerRecord<String, Order> record = new ProducerRecord<>(ORDER_TOPIC, orderObject);
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