Skip to main content

PIQQ - The OOP-based add-on for aioamqp library

Project description

# piqq
PIQQ - The OOP-based add-on for aioamqp library

## Example usage
```
class DemoReceiver(PiqqReceiver):
def get_qos_size(self):
return 1

def get_routing_keys(self):
return "rk_1", "rk_2"

def get_queue(self):
return {'queue_name': 'test_queue', 'durable': True}

def get_exchange(self):
return {'exchange_name': 'test_exchange', 'type_name': 'topic', 'durable': True}

def on_mq_message(self, channel, body, envelope, properties, callbacks):
print(body, self)
time.sleep(2)
print(envelope.delivery_tag)
callbacks['ack']()

# As a Daemon
piqq_server = Piqq('127.0.0.1', 5672, 'guest', 'guest')
piqq_server.add_command(DemoReceiver())
piqq_server.run_silently(10)
piqq_server.pub({'exchange_name': 'test_exchange', 'type_name': 'topic', 'durable': True}, 'rk_2', {'a': 'sosta'}, delivery_mode=2, serialize_as='json')
while True:
time.sleep(2)

# Exclusive
# piqq_server = Piqq('127.0.0.1', 5672, 'guest', 'guest')
# piqq_server.add_command(DemoReceiver())
# piqq_server.run_exclusive(10)
```

## Changelog
- 0.0.5
- Threading logic rework, add daemonic start: `run_silently()`
- 0.0.4
- Added text and json serializers (can be set up like `.pub(serialize_as='json')`)
- 0.0.3
- Added `callbacks` parameter to `on_mq_message` with `ack`, `nack` and `pub` functions
- 0.0.2
- Add `piqq.exception` package
- 0.0.1
- Initial version


## Publishing
```
python setup.py register -r pypi
python setup.py sdist upload -r pypi
```

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

piqq-0.0.5.zip (6.4 kB view hashes)

Uploaded Source

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