No project description provided
Project description
AMQP Client Python
Client with high level of abstraction for manipulation of messages in the event bus RabbitMQ.
Features:
- Automatic creation and management of queues, exchanges and channels;
- Support for direct, topic and fanout exchanges;
- Publish;
- Subscribe;
- Support for a Remote procedure call (RPC).
Examples:
- basic usage
# basic configuration from amqp_client_python import ( AsyncEventbusRabbitMQ, Config, Options ) from amqp_client_python.event import IntegrationEvent, IntegrationEventHandler config = Config(Options("queue", "rpc_queue", "rpc_exchange")) eventbus = AsyncEventbusRabbitMQ(config) # publish class ExampleEvent(IntegrationEvent): EVENT_NAME: str = "ExampleEvent" def __init__(self, event_type: str, message = []) -> None: super().__init__(self.EVENT_NAME, event_type) self.message = message publish_event = ExampleEvent(rpc_exchange, ["message"]) eventbus.publish(publish_event, rpc_routing_key, "direct") # subscribe class ExampleEventHandler(IntegrationEventHandler): def handle(self, body) -> None: print(body) # handle messages await eventbus.subscribe(subscribe_event, subscribe_event_handle, rpc_routing_key) # rpc_publish response = await eventbus.rpc_client(rpc_exchange, "user.find", ["content_message"]) # provider async def handle2(*body) -> bytes: print(f"body: {body}") return b"content" await eventbus.provide_resource("user.find", handle)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
amqp_client_python-0.1.3.tar.gz
(19.5 kB
view hashes)
Built Distribution
Close
Hashes for amqp_client_python-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1bcabddaecc3d721ad630860e42cf6422dbb25a19ef5d2c44fbde2fb541fb713 |
|
MD5 | 1f486fa751be8fddb112b00abc110bfb |
|
BLAKE2b-256 | 575b84d5e298bf8766f306a6c76a659fef7153155d6ecf5b368503565175c0a2 |