r3570r3 / SimpleMQ

A simple topic-pull message queue with partitioning support.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SimpleMQ

Steps

  1. Clear environment. Stop processes and remove existing containers.
docker stop CassandraNode1
docker rm CassandraNode1
  1. Build docker image.
docker build -t pubsub.java .
  1. Pull cassandra image.
docker pull cassandra
  1. Start cassandra instance and wait for it to start.
docker run -p 9042:9042 --rm --name CassandraNode1 -d cassandra
  1. Monitor with:
docker logs -f CassandraNode1

and wait for the line:

Created default superuser role 'cassandra'
  1. Run sql shell on cassandra cluster.
docker exec -it CassandraNode1 bash -c 'cqlsh'

and create the application keyspace:

CREATE KEYSPACE pubsubkeyspace 
WITH replication = 
{
    'class' : 'SimpleStrategy', 
    'replication_factor' : 1
};

also create the table:

use pubsubkeyspace;
create table if not exists pubsubkeyspace.message (
    topic text,
    partitionId int,
    payload text,
    messageDate timestamp,
    primary key((topic, partitionId), messageDate)
)
with clustering order by (messageDate asc);
  1. Get IP and load details.
docker exec -it CassandraNode1 bash -c 'nodetool status'
  1. Hit publish URL:
http://localhost:8082/api/v1/publish

and verify data in the DB:

select * from messages;

About

A simple topic-pull message queue with partitioning support.

License:MIT License


Languages

Language:Java 97.9%Language:Dockerfile 2.1%