Thanks Steven On 28 August 2017 at 18:03, Steven Elliott <selli...@cognitivemedicine.com> wrote:
> I have done this in the past using the message key. The reason I used the > key was so I did not have to unbundle the entire message to find who the > request response needed to be routed to. > > The way it worked <simplified> was that the request service would create a > key and then submit the information to be processed and the key to a > producer - the producer would send the information to the topic with the > key as metadata. The request service would bundle the req/res objects as a > map to a queue with the key as the key and the map as the value - this can > be done asynchronously. A consumer would be listening on the response > topic where the backend would publish the results using again the key as > message metadata. > > A consumer would listen on the response topic and for each message received > it would take the key from the message and pull the req/res from the > queue. It would then take the message and send it via the response. > > Again, there may be a better way to do this than using the message key > which is for other purposes but for my setup it worked flawlessly. > > Steven > > ----------------------------------------------------------------- > Steven Elliott > Director of Research Engineering > Cognitive Medical Systems, Inc. > 9444 Waples Street, Suite 300 > San Diego, CA 92121 > > > Office: 858-509-4949 x 1 <(858)%20509-4949>17 > Mobile: 5 <(720)%20339-8165>20.344.208 > > Email: selli...@cognitivemedicine.com > > > > On Mon, Aug 28, 2017 at 9:31 AM, Sean McElroy <sean.mcelroy1...@gmail.com> > wrote: > > > Hello, > > > > I have a web application that uses Kafka in the back-end. When a user > makes > > a request via the browser, the application sends a message to a Kafka > topic > > and then listens for a response sent to another topic. I'm struggling to > > see how it is possible to route the response to the user/browser that > > initiated the request. I know that we could send a GUID with the message > > and return it in the response but how can that be directed to the correct > > user/browser? Is it possible to do this using Kafka? > > > > As far as I can see, a user making a request, will receive a random > > response. > > > > Thanks. > > >