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.4.tar.gz
(19.8 kB
view hashes)
Built Distributions
Close
Hashes for amqp_client_python-0.1.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0725a434ba293d85c2e4cb193c06e97d9e7ca3529ad3fa6eabd76a934ba68290 |
|
MD5 | f3d623b500f7d44ec8cdde0bd1c89279 |
|
BLAKE2b-256 | a8364c7581f7545b993a5c43f6a64bedf85445f31dd7785ab5e9b1a84eacf432 |
Close
Hashes for amqp_client_python-0.1.4-1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea29acd8a50ce04a14e8eda76dbb582446a9e5f1b441ddb998cc4a8cd963a5e6 |
|
MD5 | 465678df16cc29805afb89f66390b01a |
|
BLAKE2b-256 | cb737db19dd2680645244b5d26c52ad5b4d2bf8c3186b78140623870a9dbc009 |