Skip to main content

A minimal multi producer single consumer IPC using redis pub/sub

Project description

Redis IPC

A lightweight multiple producer and single consumer IPC server that uses redis pubsub as a broker

Creates a redis ipc server that listens on a single pub/sub channel and allows you to communicate between multiple processes

Subclass the IPC class and add your handlers as methods like this (handlers must start with handle_ as their name)

async def handle_channel_update(self, data):
    return data

or use IPC.add_handler to add the handler after the class has been instantiated

and whenever a process calls IPC.get, all the clients connected to that channel will try to handle the request and whichever one finishes first, will be returned by the function

the handler must either return a dict or None None is treated as an implicit reason that the current process doesn't matches the requests' target process

Changelog

Version 0.2.1

Bug Fixes

  • Fixes a race condition where Future.set_result would raise InvalidStateError if another producer set a result already

Added

  • Changelog to pypi long description

Version 0.2.0

Added

  • Adds IPC.on_error handler for when a handler errors out. Takes error as first argument and message (the request data) as second

Version 0.1.0

Added

  • required_identity kwarg on IPC.get and IPC.publish
  • added more comments to examples
  • added basic logging

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

redis-ipc-0.2.1.tar.gz (17.3 kB view details)

Uploaded Source

Built Distribution

redis_ipc-0.2.1-py3-none-any.whl (17.3 kB view details)

Uploaded Python 3

File details

Details for the file redis-ipc-0.2.1.tar.gz.

File metadata

  • Download URL: redis-ipc-0.2.1.tar.gz
  • Upload date:
  • Size: 17.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for redis-ipc-0.2.1.tar.gz
Algorithm Hash digest
SHA256 b66def37b018ecde49b443a21ae0acc90865ae0e45b1dcfa29b401b7dbcc273c
MD5 ccfe6ed327f1107bf8a168ae85791ac3
BLAKE2b-256 1e9b0a5acaf59160ed4efab106b92fec7ace64ed215085abe3f0ec734debc4e4

See more details on using hashes here.

File details

Details for the file redis_ipc-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: redis_ipc-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 17.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for redis_ipc-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e57a3c010b672da054db0ee5f5bda10adffee708fdac7fa67d60047eb5853ce4
MD5 8ff8d7727a645a98ba4e3a972b12bd13
BLAKE2b-256 a7684e442b95118914d6c1cb97529146ecc6168a24fc4e68c88315f9c33fd134

See more details on using hashes here.

Supported by

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