xtdb / xtdb

An immutable SQL database for application development, time-travel reporting and data compliance. Developed by @juxt
https://xtdb.com
Mozilla Public License 2.0
2.52k stars 163 forks source link

Users can be notified when the indexer ingests documents/transactions #422

Closed spacegangster closed 4 years ago

spacegangster commented 4 years ago

(original message below)

We'd like users to be able to receive notifications from the indexer (and other areas, in the future) so that modules can react to transactions flowing through the Crux node. Potential use cases to consider:

Potential solution - event bus:


A “hook” for processed txes would ease both user subscriptions to db updates and our work with #161 . It can be a hook, an event or a signal. In its most minimal form it's just a callback accepting tx meta #:crux.tx{:tx-id 1, :tx-time 1}, so users could leverage that when working with tx-log.

Perhaps, an internal hook for accepted non-processed transactions could also ease development of new tx-log consumers, maybe even streamline the existing ones; but here I'm not so sure.

This issue is here to accumulate more thought and feedback from the core devs and the community.

fjolne commented 4 years ago

+1. That would greatly aid our transition from Firebase RealtimeDB to Crux for our custom chat service. What we basically need is a pub/sub interface to notify users of new messages, and as far as I understand currently the only way to do it with Crux is to manually subscribe to Kafka commit log.

mhuebert commented 4 years ago

I am interested in similar use-cases - ability to monitor transaction logs, and send 'invalidation' messages to subscribed clients when particular entities or entity-attribute patterns change.

One could also build something like firebase database-triggered cloud functions on top of this.

jarohen commented 4 years ago

(note to self, and @t-taylor - this might well be another application of the topology middleware we're currently considering)