ESB SQS based
Project description
Client side implementation of an ESB with Amazon SQS.
Simple Usage
# Default transport config transport = { 'prefix': 'dev-%(hostname)s-', 'priorities': ['low', 'medium', 'high'], 'polling_interval': 20, # Default queue polling interval 'retention_period': 864000, # Default queue retention period 'visibility_timeout': 30, # Default queue visibility timeout 'sleep_time': 0, # Default queue sleep time 'office_hours': True, 'region': 'eu-west-1' } bus = SwarmBus('LOGIN', 'PASSWORD', **transport) bus.connect() queue_config = { 'visibility_timeout': 5 } # Now we register a new queue bus.register_queue('new_queue', **queue_config) # Disconnect the bus to finish bus.disconnect()
Using as a producer
with SwarmBus('LOGIN', 'PASSWORD', **transport) as producer: producer.register_queue('new_queue') producer.publish( 'new_queue', {'id': 42} ) producer.publish( 'new_queue', {'id': 84}, priority=1, # Priority index, correspond to 'medium' delay=5 # Delay of the message )
Using as a consumer
def handle_message(body, message): print(body) message.delete() def error_handler(body, message): raise ValueError('Error while processing message') with SwarmBus('LOGIN', 'PASSWORD', **transport) as consumer: consumer.register_queue('new_queue') consumer.consume( 'new_queue', handle_message, error_handler )
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
swarm-bus-5.6.tar.gz
(6.4 kB
view details)
Built Distribution
swarm_bus-5.6-py2-none-any.whl
(11.8 kB
view details)
File details
Details for the file swarm-bus-5.6.tar.gz
.
File metadata
- Download URL: swarm-bus-5.6.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/36.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | da127f16011468cdd09ba492908340dd5baac4dcc9ec053617c1841cb745f4a0 |
|
MD5 | 905c3c797fdcd9d15e3fa7f824524b2d |
|
BLAKE2b-256 | baf8fa770f88893399121c5207a16c8720f2ef05044c9dc1b3d1e4a854690253 |
File details
Details for the file swarm_bus-5.6-py2-none-any.whl
.
File metadata
- Download URL: swarm_bus-5.6-py2-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/36.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 415389208af34a19a0bd21f436aa6e2182af6c0e0dd6e492570ea396aec557cb |
|
MD5 | d9f48bf7286b83a927e1e52917c0af46 |
|
BLAKE2b-256 | 3b9ecd7c2d306b95ec4060c30a54753eca968f71b73428b878f709836ac7fc43 |