Manish Kumar
Manish Kumar

Reputation: 10512

Detect a new record was added to cassandra table

I have a requirement: when a new comment is posted, i want to get all previous comment's owner id and send a notification.

Problem here is how will i know that a new comment was added to cassandra table. What will the solution for this kind of requirement ?

Upvotes: 1

Views: 627

Answers (1)

Citrullin
Citrullin

Reputation: 2321

If you want to use only cassandra, without changes, it's impossible. With changes, you have three options:

  1. You can use cassandra as embedded service in java. Here is a simple and short how to: http://prettyprint.me/prettyprint.me/2010/02/14/running-cassandra-as-an-embedded-service/index.html

  2. You can create a wrapper for your cassandra connection. An Application which handles the Cassandra Connection and is available via API for your other application.

  3. Cassandra has a trigger functionality. (Never used it and never heard that someone is using it)

I prefer the second solution. Here are the reasons why:

  • It's simpler to create.

  • You can handler all your views in this application.

  • You can validate the input, resolve relations, logging data etc.

  • You can simply push the new added comment to kafka or another message queue.

This could be a setup:

Create a new comment -> call a backend api -> call the cassandra database interface -> push a new message to kafka -> send the data to all kafka consumer

Upvotes: 1

Related Questions