Resgate x NATS Streaming

#1

Hi,

Has anyone tried using Resgate with NATS Streaming yet?
Does it work or is only the NATS core platform supported at the moment?

Best

Judi

#2

Hi Judi, and welcome to the forum! :partying_face:

The answer is kind of Yes and No, but mostly No.
I don’t know of anyone who has tried. Resgate itself requires NATS Server. It cannot use NATS Streaming for communication with the services because Resgate requires the messaging system to support the request/response pattern, which NATS Streaming does not support.

Nor would Resgate benefit from the delivery guarantees provided by NATS Streaming, as Resgate uses other means of synchronization and reliability.

That said, nothing prevents you from using NATS Streaming (or any other broker/message queue/communication solution) for inter-service communication, while using NATS Server + Resgate for the public API. You can use Resgate+NATS as an efficient replacement for the common HTTP+API Gateway layer for the public API.

Hope that answers the question. If not, I can provide more robust examples :slight_smile:

Best regards,
Samuel

#3

Hi Samuel,

Thanks for the elaborate answer, that makes sense.
I was in fact intrigued by the at-leat-once delivery promised by NATS Streaming but I guess I won’t even need that if Resgate already provides means to achieve the same result.

Best

Judi

#4

Hi again!

The result is close to the same, but not entirely :slight_smile:

Streaming focuses on events/messages, and will make sure each message is delivered at least once.
Resgate does it differently. It focuses on the resource data. If there is a hiccup, causing possible loss of events, it will refetch the data, and then generate new events based on the difference between the newly fetched data and what is stored in the cache.

So, streaming is useful when the events are important.
But usually for frontend, you don’t care about events - you care about the state of the data you wish to display, that it is (eventually) the same as on the server. That is what Resgate guarantees.

/Samuel