Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

407
Views
Using Kafka in a resquest/response scenario inside a REST web service

I am currently building a REST web service that needs to communicate with Kafka in a request/response pattern. (I know that Kafka is not really designed for that).

  1. Client calls the REST web service.
  2. REST web service publishes a message to Kafka
  3. On the other side of Kafka, an app consumes the message and publishes the response back to Kafka
  4. (inside the same request as #2)REST web service listens to Kakfa and wait for response corresponding to the request
  5. REST web service returns the response to the client

Steps 1 to 3 seems pretty easy but I'm struggling with step 4.

My idea was to propagate an ID in each message so that I could retrieve the response corresponding to the request.

However, I have a hard time figuring out how to set up the listener on the REST web service. How can the listener returns the message to the controller?

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

i think is better just create a topic for each user, then the user can send a message to another service, such message is like:

{
user:"myUserName"
data:"data of message"
}

then the service just need to push to the topic "user.myUserName" Then from the web client just need to be subscribed to "user.myUserName" (with a consumergroup configuration, this just for read only the newest messages )...

i think the best way is just implement websocket and then push/read by that way ;)

Bye and good day.

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!