Skip to main content

Ipcqueue provides POSIX and SYS V message queues functionality to exchange data among processes.

Project description

This package provides SYS V and POSIX message queues to exchange data among processes. Both queues have similar functionality with some differences. Queues are persistent in the kernel unless either queue is closed/unlinked or system is shut down. Unlike multiprocessing.Queue, the same queue can be joined by different processes according to its unique name/key, it’s not necessary to fork main process. Be careful if you use signals in your application, because signal interrupts sending or receiving message.

Installation

Requires Python CFFI, C compiler and Python header files.

cd ipcqueue/
python setup.py install

Usage

>>> from ipcqueue import posixmq
>>> q = posixmq.Queue('/foo')
>>> q.qsize()
0
>>> q.put([1, 'A'], priority=1)
>>> q.put([2, 'B'], priority=2)
>>> q.put([3, 'C'], priority=1)
>>> q.qsize()
3
>>> q.get()
[2, 'B']
>>> q.get()
[1, 'A']
>>> q.get()
[3, 'C']
>>> q.close()
>>> q.unlink()

>>> from ipcqueue import sysvmq
>>> q = sysvmq.Queue(1)
>>> q.qsize()
>>> q.put([1, 'A'], msg_type=1)
>>> q.put([2, 'B'], msg_type=2)
>>> q.put([3, 'C'], msg_type=2)
>>> q.put([4, 'D'], msg_type=1)
>>> q.qsize()
4
>>> q.get(msg_type=2)
[2, 'B']
>>> q.get()
[1, 'A']
>>> q.get()
[3, 'C']
>>> q.get()
[4, 'D']
>>> q.close()

Documentation

http://pythonhosted.org/ipcqueue

License

3-clause BSD

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

ipcqueue-0.9.4.tar.gz (15.9 kB view details)

Uploaded Source

File details

Details for the file ipcqueue-0.9.4.tar.gz.

File metadata

  • Download URL: ipcqueue-0.9.4.tar.gz
  • Upload date:
  • Size: 15.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for ipcqueue-0.9.4.tar.gz
Algorithm Hash digest
SHA256 52a2f22b9030f988e91c1dcdc3ce884363ad26b79c8075d78497fbc4f17f6b99
MD5 848595f72b46d1636c2a8edfb74fa131
BLAKE2b-256 9a8a0d8c03b2d7a0d0925cfe70d7ad5591973fe0bfce4a5bce4257f45f6b4652

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