Fork me on GitHub
#xtdb
<
2020-04-12
>
Jacob O'Bryant06:04:32

Is there a good way to watch the transaction log? I've got this so far:

(doseq [tx (iterator-seq (crux/open-tx-log node 0 false))]
  (prn tx))
But the iterator closes after all the transactions have been consumed. I want something similar that blocks until the next transaction is available (or returns a channel, or lets me pass in a callback function). If there's not some kind of internal API I could use, my plan B is to set up my own queue and run all the transactions through that.

refset08:04:56

Hello! Polling the last seen tx-id +1 using the above snippet in a loop with pushing a message to a channel should work. We don't expose a convenient API for this right now, but as you're the second person I've spoken to about it in the last 24hrs(!) I'll make it a priority to expose it via a new module in the coming week. It's a matter of wiring up the internal event bus to something more user friendly

Jorin11:04:05

Plus one on this 😉

richiardiandrea18:04:41

Plus One! The change data capture flow is nice to have when your architecture is event driven + microservices

richiardiandrea18:04:24

What we also asked ourselves at some point is how to tap onto the Kafka transaction topic. The use case was to aggregate and produce other topics from it.