krakend / krakend-pubsub

a pubsub backend for the KrakenD framework
https://www.krakend.io
Apache License 2.0
10 stars 17 forks source link

Using NATS request/reply mechanism #12

Open ospatil opened 3 years ago

ospatil commented 3 years ago

Thank you for the wonderful krakend project. I am quite new to it and would like to use it with NATS to carry out protocol translation for microservices. The flow I would like to have is:

  1. Krakend receives a http request.
  2. It converts it to a message on a NATS subject, uses the NATS request-reply mechanism to wait for the backend response.
  3. Once response is received, converts it to http response and retuns it to the caller.

NATS allows us to use request-reply mechanism by setting "reply" header on the NATS message to a dynamic "inbox" subject and setting up a listener for it. The plumbing for this is setup by the NATS client libraries.

I looked at and experimented with krakend-pubsub functionality and couldn't find a way to use the request-reply mechanism.

Is there any way I can do this? Is there something obvious that I have missed?

Thanks again!

ospatil commented 3 years ago

Any ideas or pointers for the above question? I wouldn't mind extending the functionality and providing a PR. Any help is appreciated.