I am working on containerization application where a front-end application calls HTTP request to API gateway. The request data received at API Gateway is forward to Micro service via Kafka. But I have to send the response back the result as response back to API gateway and back to front-end application. Can anyone please guide me how can I achieve the synchronous request and response between API gateway and micron service via Kafka.
I have tried with Producer and Consumer, which is like Fire and forget where I am unable to respond back the request.
Producer Code :
using var p = new ProducerBuilder<string, string>(config).Build();
// Send the message to our test topic in Kafka
var dr = await p.ProduceAsync("test", message);
Consumer Code :
using var c = new ConsumerBuilder<Ignore, string>(conf).Build();
c.Subscribe("test");
// Consume a message from the test topic.
var cr = c.Consume(cts.Token);