Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyMQ!

Simple Messaging Queue in Python

PyMQ! is a simple messaging queue developed in Python.

Python Version License

Features

  • FIFO messaging queue
  • Adressed messages with sender and recipient
  • TCP connection to push/retrieve messages
  • Token authentication
  • In memory cache (with size limit)
  • Storage in PostgreSQL database

TODO

  • Change to a nonblocking socket (currently you cant ctrl+c to exit lol)
  • Make it async
  • Create API routes to push/retrieve messages
  • Create cleaning routines for DB

Installation and usage

Installation

Installing PyQ! is as simple as cloning and running a Python project on any OS. It requires just a terminal and Python 3.9+.

git clone https://github.com/dbx0/pymq
cd pymq/
pip install -r requirements.txt

Setup

Use the schema.sql file to create your schema in a PostgreSQL database.

Create your own .env file based on .env.example and add your settings.

To get started right away, just run it with Python.

python3 run.py

Usage

The TCP listener is waiting for your message through socket in the selected port.

You can check some Python code examples inside the examples folder. The conversation should go as below:

Authentication

To start a conversation, your first message will be your authentication token. You can get two responses in this case.

Failed authentication:

client: <authentication token>
server: "Invalid token"

Success authentication:

client: <authentication token>
server: "Authentication successful"

Retrieving data

The get_message command will retrieve messages to the recipient based on the token provided in the authentication.

Empty queue:

client: get_message
server: "No messages available"

Getting multiple messages from queue.

client: get_message
server: <message body>
client: get_message
server: <message body>
...
client: get_message
server: "No messages available"

Pushing data

The push_message command will start a conversation to get your message. It requires the recipient name as a parameter.

client: push_message <recipient_name>
server: "Waiting message"
client: <message body>
server: "Message added to queue

Feedback

If you have any feedback, please reach out to me at X @malwarebx0

License

GPL3.0

About

PyMQ is a simple messaging queue created in Python with multiple cool features!

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages