Fauna, the company behind the Fauna transactional database, recently announced the general availability of event streaming, a push-based stream that sends changes at both the document and collection levels to subscribed clients.
Shashank Golla, senior product marketing manager at Fauna, explains:
Fauna’s event streaming employs an open, push-based streaming method to automatically stream real-time data updates to your clients when there is a change in your database. Unlike polling, in event streaming the subscription from the client side happens once and changes are automatically broadcast to the client whenever the subscribed document or collection is updated.
Source: https://fauna.com/blog/event-streaming#ensure-clients-have-least-privilege-access-with-abac
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 triggered.
A distributed database, Fauna is an object-relational, globally replicated service that supports an indexed-document data model and distributed ACID transactions. A subscription is a connection to the cloud service that is held open by the client through the Fauna driver and set and document streaming features are available using the C#, Go, JavaScript, JVM (Java, Scala) and Python drivers. Explaining how to integrate event streaming using a sample react application, Shadid Haque, developer advocate at Fauna, suggests:
Avoid running a query to fetch a document and then establishing a stream. Multiple events may have modified the document prior to stream startup, which can lead to an inaccurate representation of the document data in your application.
Event streaming databases have become popular in the last few years and the major cloud providers offer different managed options to stream data, including DynamoDB Streams and AWS Kinesis Datastream, Datastream on Google Cloud and Azure Event Hubs. CockroachDB and Astra DB support event-driven architectures using Change Data Capture (CDC). Jeremy Daly, GM of serverless cloud at Serverless Inc, comments in his latest newsletter:
If you are a database provider and you’re not drifting into the world of event-driven architecture, you might as well start looking for something else to do.
To ensure that clients have least privilege access, Golia suggests using ABAC, a Fauna’s extension of the traditional role-based access control:
With ABAC, you can implement least privilege access using streaming and provide real-time changes to only the users who should be receiving the updates.
The following limitations apply to Fauna event streaming: GraphQL subscriptions are currently not supported, a browser can open a maximum of 100 streams and a document stream reports only events for the fields and values within the document’s data field.
Event streaming is charged according to usage and is available in all Fauna pricing plans. Each streamed event counts two read operations and includes 4k bytes read from storage, plus one read operation per additional 4k bytes, per subscriber. One compute operation per subscriber is counted for every second a stream is held open.