tree: c914fb0299716f14bbc65f9cde2e585503839d17 [path history] [tgz]
  1. src/
  2. docker-compose.yaml
  3. pom.xml

Resume API Example: Cassandra

This example shows how to use the Resume API for consuming data from Apache Cassandra.

First the demo load 500 records into the database. Then, it consumes then in batches of 50 messages. It starts each batch at the point of last consumption. The offsets are stored in a Kafka topic.

Note: this demo runs in a container. Although it is possible to run it outside a container, doing so requires additional infrastructure. Therefore, it's not extensively covered by the documentation.

Building the demo

To build the demo and the containers:

mvn clean package && docker-compose build


To run the demo:

docker-compose up -d && docker-compose logs --no-log-prefix -f example ; docker-compose down

Advanced / Manual

Launch Cassandra

docker run -p 9042:9042 -it cassandra:4

Data Load

To load the data run:

  java \
       -Dcassandra.cql3.port=9042 \
       -Dresume.action=load \
       -jar /deployments/example.jar

Note: make sure you have copied the jar file generated during the build to /deployments/example.jar.

Run the Example

java -Dresume.type=kafka \
           -Dresume.type=kafka \
           -Dresume.type.kafka.topic=cassandra-offsets \
           -Dcassandra.cql3.port=9042 \
           -Dbootstrap.address=kafka-host:9092 \
           -Dbatch.size=50 \
           -jar /deployments/example.jar