RabbitMQ app framework
Project description
RabbitBus
Feel RabbitMQ like HTTP
- Custom CorrelationManagers
- Regexp roures
Installation
RabbitBus requires Python 3.6 >, aioamqp.
Install the dependencies and library.
$ pip install rabbitbus
Example:
import asyncio
import logging
from rabbitbus.manager import DatabusApp, Configuration
from acks.requests import AmqpRequest
from acks.responses import AckResponse
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
ch.setFormatter(formatter)
logger.addHandler(ch)
async def my_view(request: AmqpRequest):
# Write your code here
return AckResponse()
def serve():
loop = asyncio.get_event_loop()
# Inherit from CorrelationManager for custom correlation storages
app = DatabusApp(conf=Configuration())
app.add_route(r'^CASH_REGISTER_EQUIPMENTS[a-zA-Z_]{4}$', my_view, as_list=True)
app.start(loop)
if __name__ == '__main__':
serve()
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
rabbitbus-0.0.6.tar.gz
(5.6 kB
view hashes)
Built Distribution
Close
Hashes for rabbitbus-0.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 29560ea29a5e0185cf4f1ce5073385d70f9a09b0336853ffabf450b1ebdc4954 |
|
MD5 | 4816e9f68306ce4984c45abbf2e72302 |
|
BLAKE2b-256 | e14106f940b0a8a3e0fb6c680529ba2af07fbaee16ed2fbcd9323ecb497a4728 |