监听 Cassandra 数据存储的变化? [英] Listen for Changes In Cassandra Datastore?

查看:22
本文介绍了监听 Cassandra 数据存储的变化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否可以向 Cassandra 添加一个监听器来获取表和更改条目的主键?要是有这样的机制就好了.

I wonder if it is possible to add a listener to Cassandra getting the table and the primary key for changed entries? It would be great to have such a mechanism.

检查 Cassandra 文档,我只发现将 StateListener(s) 添加到 Cluster 实例.

Checking Cassandra documentation I only find adding StateListener(s) to the Cluster instance.

有没有人知道如何在不侵入 Cassandra 数据存储或封装驱动程序并自己做一些事情的情况下做到这一点?

Does anyone know how to do this without hacking Cassandras data store or encapsulate the driver and do something on my own?

推荐答案

如果客户需要了解变化,世界大多采用消息代理模型——连接任意数据的生产者和消费者的中间人.您可以阅读有关 Kafka、RabbitMQ 和 NATS 此处.有一篇较旧的 DZone 文章这里.在您的情况下,写入数据库的客户端也会发出更改消息.此模型的优点在于您可以从数据库中提取任何您需要的内容.

If clients need to know about changes, the world has mostly gone to the message broker model-- a middleman which connects producers and consumers of arbitrary data. You can read about Kafka, RabbitMQ, and NATS here. There is an older DZone article here. In your case, the client writing to the database would also send out a change message. What's nice about this model is you can then pull whatever you need from the database.

Kafka 很有趣,因为它也可以存储数据.在某些情况下,您可能可以完全处理数据库.

Kafka is interesting because it can also store data. In some cases, you might be able to dispose of the database altogether.

这篇关于监听 Cassandra 数据存储的变化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆