Apache Kafka with Spring Boot REST

0

Currently I am developing a project based on a microservice architecture and the idea is that each microservice is with Spring Boot and communication with them is through Apache Kafka. You want to expose a REST API so that the Frontend consumes the information.

The problem I have to perform the REST API is to uniquely identify each request when using Apache Kafka, that is, imagine the following scenario:

  • There is a microservice called Users that contains the information of system users. Listen to the topic searchUser with KafkaListener.
  • The REST API exposes /usuarios/:id to retrieve the information of a user with the ID as parameter
  • The client sends a request to /usuarios/1
  • The REST API sends a message to the searchUser topic providing the ID that comes in the URL
  • The microservice answers the message of the topic
  • The question is, how can I respond from Kafka so that the client's request with the information requested can be completed?

    I searched for examples with Spring Boot and found this link

    But he does not focus on making a response from the microservice with Kafka.

        
    asked by Jorge Ramón 08.02.2018 в 18:41
    source

    0 answers