Commit 350c2bc5 authored by Shanelle Valencia's avatar Shanelle Valencia

Add new proper topic names

parent 97c61015
import axios from 'axios'; import axios from 'axios';
export const getOrders =() => { export const getOrders =() => {
return axios.get(`http://localhost:8080/api/orders`); return axios.get(`http://localhost:8081/api/orders`);
} }
export const editOrder = (order) => { export const editOrder = (order) => {
return axios.put(`http://localhost:8080/api/orders/${order.id}`, order) return axios.put(`http://localhost:8081/api/orders/${order.id}`, order)
} }
...@@ -2,6 +2,6 @@ import axios from "axios"; ...@@ -2,6 +2,6 @@ import axios from "axios";
export const createSession = (payload) => { export const createSession = (payload) => {
return axios return axios
.post("http://localhost:8080/api/auth", payload) .post("http://localhost:8081/api/auth", payload)
.catch((err) => err.response); .catch((err) => err.response);
}; };
...@@ -44,7 +44,7 @@ public class KafkaConfig { ...@@ -44,7 +44,7 @@ public class KafkaConfig {
} }
@Bean @Bean
public KafkaReceiver<String, String> kafkaEventReceiver(@Value("${kafka.topic.input}") String topic) { public KafkaReceiver<String, String> kafkaEventReceiver(@Value("OMS_ORDER_UPDATE") String topic) {
ReceiverOptions<String, String> receiverOptions = ReceiverOptions.create(consumerFactory()); ReceiverOptions<String, String> receiverOptions = ReceiverOptions.create(consumerFactory());
receiverOptions.maxCommitAttempts(5); receiverOptions.maxCommitAttempts(5);
return KafkaReceiver.create(receiverOptions.addAssignListener(Collection::iterator).subscription(Collections.singleton(topic))); return KafkaReceiver.create(receiverOptions.addAssignListener(Collection::iterator).subscription(Collections.singleton(topic)));
......
...@@ -23,12 +23,12 @@ public class Sender { ...@@ -23,12 +23,12 @@ public class Sender {
private KafkaSender<String, WarehouseOrderResponse> kafkaUpdateEventProducer; private KafkaSender<String, WarehouseOrderResponse> kafkaUpdateEventProducer;
private static final String TOPIC = "warehouse_management"; private static final String TOPIC = "WMOS_ORDER_UPDATE";
private static final String OMS = "order_management"; private static final String OMS = "OMS_ORDER_UPDATE";
public void sendOrder(WarehouseOrderRequest currentOrder) { public void sendOrder(WarehouseOrderRequest currentOrder) {
ProducerRecord<String, WarehouseOrderRequest> record = new ProducerRecord<>(OMS, currentOrder); ProducerRecord<String, WarehouseOrderRequest> record = new ProducerRecord<>(TOPIC, currentOrder);
Flux<SenderResult<WarehouseOrderRequest>> sendToKafka = kafkaOMSProducer.send(Mono.just(SenderRecord.create(record, currentOrder))) Flux<SenderResult<WarehouseOrderRequest>> sendToKafka = kafkaOMSProducer.send(Mono.just(SenderRecord.create(record, currentOrder)))
.doOnError(throwable -> System.out.println(throwable)) .doOnError(throwable -> System.out.println(throwable))
.doOnNext(t -> { .doOnNext(t -> {
...@@ -40,7 +40,7 @@ public class Sender { ...@@ -40,7 +40,7 @@ public class Sender {
} }
public void sendUpdatedOrder(WarehouseOrderResponse currentOrder) { public void sendUpdatedOrder(WarehouseOrderResponse currentOrder) {
ProducerRecord<String, WarehouseOrderResponse> record = new ProducerRecord<>(TOPIC, currentOrder); ProducerRecord<String, WarehouseOrderResponse> record = new ProducerRecord<>(OMS, currentOrder);
Flux<SenderResult<WarehouseOrderResponse>> sendToKafka = kafkaUpdateEventProducer.send(Mono.just(SenderRecord.create(record, currentOrder))) Flux<SenderResult<WarehouseOrderResponse>> sendToKafka = kafkaUpdateEventProducer.send(Mono.just(SenderRecord.create(record, currentOrder)))
.doOnError(throwable -> System.out.println(throwable)) .doOnError(throwable -> System.out.println(throwable))
.doOnNext(t -> { .doOnNext(t -> {
......
...@@ -15,9 +15,9 @@ public class Item { ...@@ -15,9 +15,9 @@ public class Item {
private String itemName; private String itemName;
private int itemQuantity; private int itemQuantity;
private double itemPrice; private double itemPrice;
private int itemSku; private String itemSku;
public Item(String itemId, String itemName, int itemQuantity, double itemPrice, int itemSku) { public Item(String itemId, String itemName, int itemQuantity, double itemPrice, String itemSku) {
this.itemId = itemId; this.itemId = itemId;
this.itemName = itemName; this.itemName = itemName;
this.itemQuantity = itemQuantity; this.itemQuantity = itemQuantity;
......
...@@ -5,4 +5,9 @@ spring.data.mongodb.database=test ...@@ -5,4 +5,9 @@ spring.data.mongodb.database=test
kafka.producer.bootstrap-servers: localhost:9092 kafka.producer.bootstrap-servers: localhost:9092
kafka.producer.acks: all kafka.producer.acks: all
kafka.consumer.group-id: WAREHOUSE_MANAGEMENT kafka.consumer.group-id: WAREHOUSE_MANAGEMENT
kafka.topic.input: order_management kafka.topic.input: WMOS_ORDER_UPDATE
\ No newline at end of file #kafka.topic.input: OMS_ORDER_UPDATE
server.port=8081
\ No newline at end of file
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