Skip to main content

No project description provided

Project description

PyLucidMQ

What is it

This is the python implementation and client library using LucidMQ

Create a New Development environement

  1. Create python virtual environment
python3 -m venv env
  1. Install Dependencies Make sure to activate your virtual environment
pip install maturin
  1. Install pylucidmq library in project
maturin develop

Disclaimer: only works on macOS and linux at the moment

Installation

pip install lucidmq

Example Usage

Basic program to get you working with streams instantly

import pylucidmq
import time

def test_message():
    key = b'key1'
    value = b'value'
    x = pylucidmq.Message(key, value)
    y = x.serialize_message()
    print(y)

# Produce messages to your desired topic
def test_producer(lucidmq):
    producer = lucidmq.new_producer("topic1")
    for x in range(10):
        key = "key{0}".format(x).encode()
        value = "value{0}".format(x).encode()
        x = pylucidmq.Message(key, value)
        producer.produce_message(x)
        time.sleep(1)

# Consumer messages
def test_consumer(lucidmq):
    consumer = lucidmq.new_consumer("topic1", "group1")
    # Poll will poll from the latest marked offset in the consumer group
    # and return all the found messages
    messages = consumer.poll(100)
    for message in messages:
        key = bytes(message.key)
        value = bytes(message.value)
        print(key.decode("utf-8"))
        print(value.decode("utf-8"))
    print("-------------------------")
    # Fetch will grab all messages from a certain offset on
    # upto the amount of messages specified
    fetch_messages = consumer.fetch(0, 5)
    for message in fetch_messages:
        key = bytes(message.key)
        value = bytes(message.value)
        print(key.decode("utf-8"))
        print(value.decode("utf-8"))

#Declare a new instance of lucidmq
lucidmq = pylucidmq.LucidMQ("test_log", 1000, 500)
test_producer(lucidmq)
test_consumer(lucidmq)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lucidmq-0.1.1.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lucidmq-0.1.1-cp312-cp312-macosx_11_0_arm64.whl (301.9 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

Details for the file lucidmq-0.1.1.tar.gz.

File metadata

  • Download URL: lucidmq-0.1.1.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.7.4

File hashes

Hashes for lucidmq-0.1.1.tar.gz
Algorithm Hash digest
SHA256 df137c4491f403d3196ea73186d9226a9eddc76b6576d564cde240a2a9efa1f4
MD5 f24e3f4866b0c7b632ef5019333d10d3
BLAKE2b-256 553fec6ebdb7487bc618319838410bda409e1ca4a4015058c33da8487cd397e0

See more details on using hashes here.

File details

Details for the file lucidmq-0.1.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lucidmq-0.1.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e898e7a6880cbd4fd6e4bc9d2eb31018f7d9887f5bf966608be1d75c1bba3088
MD5 f9660f0ad0d2b9eb10a6e8f465942a12
BLAKE2b-256 999d91dd845e548d166aafc2922a598ef4ee559aaf13431964433604eb5c7c52

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page