Appearance
Quick Start
This combined guide covers installing the broker and publishing/consuming your first messages in under 5 minutes.
Install (Debian/Ubuntu)
bash
wget https://cometmq.vercel.app/downloads/cometmq-broker_0.0.2-1_amd64.deb
sudo dpkg -i cometmq-broker_0.0.2-1_amd64.deb
sudo systemctl enable cometmq-broker
sudo systemctl start cometmq-broker
After installation:
- Web UI: http://localhost:15672/ui
- Config: /etc/cometmq/cometmq.yaml
Service Management
bash
sudo systemctl status cometmq-broker
sudo journalctl -u cometmq-broker -n 100
Basic Verification
bash
cometmq-cli durable-status
cometmq-cli flow-status
cometmq-cli queues list
Uninstall
bash
sudo systemctl stop cometmq-broker
sudo dpkg -r cometmq-broker
Notes:
- Clustering not implemented.
- License file optional (defaults to Core tier if absent).
Publish a Message (Python)
Install the AMQP client:
bash
pip install pika
Create publisher.py:
python
import pika
connection = pika.BlockingConnection(
pika.ConnectionParameters('localhost', credentials=pika.PlainCredentials('admin', 'password'))
)
channel = connection.channel()
# Declare exchange and queue
channel.exchange_declare(exchange='logs', exchange_type='fanout', durable=True)
channel.queue_declare(queue='my-queue', durable=True)
channel.queue_bind(exchange='logs', queue='my-queue')
# Publish message
channel.basic_publish(
exchange='logs',
routing_key='',
body=b'Hello CometMQ!',
properties=pika.BasicProperties(delivery_mode=2) # persistent
)
print("Message sent!")
connection.close()
Run:
bash
python publisher.py
Consume Messages (Python)
Create consumer.py:
python
import pika
connection = pika.BlockingConnection(
pika.ConnectionParameters('localhost', credentials=pika.PlainCredentials('admin', 'password'))
)
channel = connection.channel()
def callback(ch, method, properties, body):
print(f"Received: {body.decode()}")
ch.basic_ack(delivery_tag=method.delivery_tag)
channel.basic_consume(queue='my-queue', on_message_callback=callback)
print('Waiting for messages...')
channel.start_consuming()
Run:
bash
python consumer.py
Using the CLI
List queues:
bash
cometmq-cli queues list
Get queue details:
bash
cometmq-cli queues get / my-queue
Purge queue:
bash
cometmq-cli queues purge / my-queue
Monitoring
Open the Web UI:
http://localhost:15672/ui
Check Prometheus metrics:
http://localhost:15672/metrics