Fauna, the company behind the Fauna transaction database, recently published the general availability of event streaminga push-based stream that sends both document- and collection-level changes to subscribed clients.
Shashank Golla, Senior Product Marketing Manager at Fauna explains:
Fauna’s event streaming uses an open, push-based streaming method to automatically stream real-time data updates to your customers when your database changes. Unlike fetching, event streaming subscribes once from the client side and automatically pushes changes to the client when the subscribed document or collection is updated.
Fauna supports two types of event streaming: document streaming, where the client subscribes to a document reference, and set streaming, where the client subscribes to a set reference and when one or more documents enter or leave the set, an event notification is sent triggered.
Avoid running a query to get a document and then setting up a stream. Multiple events may have modified the document before the stream started, which can result in an inaccurate representation of the document data in your application.
Event Streaming Databases have become popular in recent years and are offered by the major cloud providers various managed options to stream data, including DynamoDB Streams and AWS Kinesis data stream, data stream on Google Cloud and Azure Event Hubs. Cockroach DB and AstraDB support event-driven architectures with Change Data Capture (CDC). Jeremy DalyGM of Serverless Cloud at Serverless Inc, comments in his latest Newsletter:
If you’re a database vendor and don’t stray into the world of event-driven architecture, you might as well look elsewhere.
To ensure clients have least privilege access, Golia recommends using ABACa fauna extension of traditional role-based access control:
With ABAC, you can implement least privilege access using streaming and deliver real-time changes only to the users who should receive the updates.
The following limitations apply to streaming Fauna events: GraphQL subscriptions are not currently supported, a browser can open a maximum of 100 streams, and a document stream only reports events for the fields and values in the document’s data field.
Event streaming is billed on consumption and is available in all Fauna pricing plans. Every streamed event counts two reads and includes 4 kbytes read from memory plus one read operation for every additional 4 kbytes per subscriber. One computation per subscriber is counted for every second a stream is kept open.