Skip to content

Latest commit

 

History

27 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

An example of chat, based on Apache Cassandra with pagination

  • Pagination, based on spring-cassandra-pagination-example
  • Creating keyspace from .cql file in docker-entrypoint-initdb.d, what's provided by bitnami image
  • Liquibase migrations

Links

Start

docker compose up -d
docker logs -f cassandra-example-cassandra-1

Wait until you see in Cassandra logs (Startup complete, Creating replication, ...), it takes about of 1 minute.

Then start Launcher from your IDE.

Then you can

Generate messages

curl -Ss -X PUT 'http://localhost:8080/api/message/generate?chatCount=10&messageCount=1000000&pinned=false' | jq
curl -Ss -X PUT 'http://localhost:8080/api/message/generate?messageCount=10&pinned=true' | jq
curl -Ss -X PUT 'http://localhost:8080/api/message/generate2?chatId=11&messageCount=10000&pinned=false' | jq

Perform pagination

curl -Ss 'http://localhost:8080/api/message/chat/1' | jq
curl -Ss 'http://localhost:8080/api/message/chat/1?limit=10&pagingState=000A000800000000000F4236F07FFFFFF5F07FFFFFF5' | jq

Try validation

curl -Ss 'http://localhost:8080/api/message/chat/1?limit=10000' | jq

See keyspaces

docker exec -it cassandra-example-cassandra-1 bash
nodetool status
cqlsh -u cassandra -p cassandra
DESC KEYSPACES;

Query pinned messages

docker exec -it cassandra-example-cassandra-1 cqlsh -u cassandra -p cassandra
select * from store.message where chat_id = 1 and pinned = true;

Search (after a bout of 1 minute, when the index will be built, wait until Cassandra stop write Flushed index segment to log)

select * from store.message where chat_id = 1 and body like '%hello8888%' limit 10;
select * from store.message where chat_id = 1 and body like '%hello%' limit 10;

About

An example of chat, based on Apache Cassandra with pagination

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Used by

Contributors

Languages