Skip to main content

Simple Object-based Message Queue

Jackie Yang

Installation:

pip install somq

Usage:

import time
from enum import IntEnum
from somq import MessageQueue


class Topic(IntEnum):
    A = 1
    B = 2
    C = 3

    @staticmethod
    def all() -> ['Topic']:
        return [e.value for e in Topic]


mq = MessageQueue()
q_all = mq.subscribe([Topic.A, Topic.B, Topic.C])
q_a = mq.subscribe(Topic.A)
# publish to all
mq.publish(Topic.all(), 'all')
# publish to a
mq.publish(Topic.A, 'a')
# receive from all
print(q_all.get())
print(q_all.get())
# print 'all' and 'a'
# receive from a
print(q_a.get())
# print 'a'
# use a function to subscribe to a topic
thread = mq.subscribe_function(Topic.A, lambda x: print(x))
# publish to a
mq.publish(Topic.A, 'a')
# print 'a'
time.sleep(0.1)
# stop the thread
thread.stop()

Metadata

Release files for somq 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for somq 0.1.5
File Size Uploaded
somq-0.1.5.tar.gz 11.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for somq 0.1.5
File Interpreter ABI Platform
somq-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 21.9 kB

Release files / somq-0.1.5.tar.gz

Download URL somq-0.1.5.tar.gz
Size 11.1 kB
Tags Source
SHA-256 checksum
How to use checksums
80f7b59ee05f7dd43d3fb1dc6263a54dca7bb409211d2850b89a4b0a67b9473e
BLAKE2b-256 checksum
How to use checksums
7ebd0e31bdd854ab5c4f9373c47857fbc5bec2c7d47313032a233a3ed4887a6b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release files / somq-0.1.5-py3-none-any.whl

Download URL somq-0.1.5-py3-none-any.whl
Size 10.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1ff11306192849f02c9f88a2fd4c4c49681c927efa0885a05488ce1187c6b9ef
BLAKE2b-256 checksum
How to use checksums
0deb649ed4213444a1d89d36409e173cb4722126f0289bcc7aed3efd8c5a9c3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page