SiraBus
SiraBus is a simple opinionated library for publishing and subscribing to events in an asynchronous and type-safe manner (to the extent that type safety can be achieved in Python).
Users publish events to an IPublishEvents interface, and users can subscribe to events by passing instances of an
IHandleEvents interface to a ServiceBus implementation.
There's a TopographyBuilder that allows you to build a service bus topology, which is a declaration of queues and
exchanges (based on transport protocol) that the service bus will use. This is useful for setting up the service bus in
a production environment.
Example Usage
from sirabus import HierarchicalTopicMap, IHandleEvents
from sirabus.servicebus.amqp_servicebus import AmqpServiceBus, AmqpServiceBusConfiguration
import asyncio
class MyEventHandler(IHandleEvents):
async def handle(self, event, headers):
print(f"Handling event: {event} with headers: {headers}")
topic_map = HierarchicalTopicMap()
config = (AmqpServiceBusConfiguration.default()
.with_amqp_url("amqp://guest:guest@localhost/")
.with_topic_map(topic_map=topic_map)
.with_handlers(MyEventHandler()))
# It can be further configured with SSL options, prefetch count, etc.
service_bus = AmqpServiceBus(
configuration=config
)
asyncio.run(service_bus.run())
The run method starts the service bus and begins consuming messages from RabbitMQ.
The stop method should be called to gracefully shut down the service bus and close the connection to RabbitMQ.
The message handling feature sets up a simple example of how to use the library. It sets up a service bus, registers a handler for a specific event type, and then publishes an event. The handler receives the event and processes it.
Supported Message Transport Protocols
SiraBus supports the following message transport protocols:
| Protocol | Description |
|---|---|
| In-Memory | For local development and testing. |
| AMQP | For production use with RabbitMQ. |
| SQS | For production use with AWS SQS. |
| Redis | For production use with Redis. |
Specific Topics
- Service Bus: Overview of the service bus and its components.
- Hierarchical Topics: Explanation of hierarchical topics and how to use them.
- Event Handling: How to handle events using the service bus.
- Command Handling: How to handle commands using the service bus.
Metadata
Release files for sirabus 0.7.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| sirabus-0.7.1.tar.gz | 27.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sirabus-0.7.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 78.5 kB
Release files / sirabus-0.7.1.tar.gz
| Download URL | sirabus-0.7.1.tar.gz |
|---|---|
| Size | 27.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9bd8d17585d4bc1fd12c12e7aa1e76b71d5f4d77a7f4e984c31b0c61b5d67688
|
|
BLAKE2b-256 checksum How to use checksums |
b2ab9556fb6835cf568df465713456295f7a6a00e961944f5e6f64818d468b64
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / sirabus-0.7.1-py3-none-any.whl
| Download URL | sirabus-0.7.1-py3-none-any.whl |
|---|---|
| Size | 51.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c0927549b031600275099b02db0d69e8e0a60a2d22931d30b81b8e66ccd5973a
|
|
BLAKE2b-256 checksum How to use checksums |
594a54aa53631f6a6fc171f14d66f51cd5002311550cb69ca3d33f339be92816
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Security for sirabus 0.7.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.