Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

405
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda