Click here to Skip to main content
14,766,084 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

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.

Thanks in Advance.


What I have tried:

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();
 // Consume a message from the test topic. 
                    var cr = c.Consume(cts.Token);

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900