GithubHelp home page GithubHelp logo

dbx0 / pymq Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 23 KB

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

License: GNU General Public License v3.0

Python 91.15% PLpgSQL 8.85%

pymq's Introduction

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

pymq's People

Contributors

dbx0 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.