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.10.tar.gz
(6.7 kB
view details)
Built Distribution
swarm_bus-5.10-py2-none-any.whl
(11.9 kB
view details)
File details
Details for the file swarm-bus-5.10.tar.gz
.
File metadata
- Download URL: swarm-bus-5.10.tar.gz
- Upload date:
- Size: 6.7 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 | 4a2de5c6f0281361734ef38564dee906f18d48e66b6c80ece6071c3894b58741 |
|
MD5 | f7ed4a6faed8ea60af4c69564c58a6f8 |
|
BLAKE2b-256 | cd039b4c90d38ae0dfc3a9532152ea7ea4c2ba007d557ad23dccb566d0a5ebdc |
File details
Details for the file swarm_bus-5.10-py2-none-any.whl
.
File metadata
- Download URL: swarm_bus-5.10-py2-none-any.whl
- Upload date:
- Size: 11.9 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 | 9aaf70a2da35095342659c1641d5d1468fa490dcea0d75cf43e6b6dcb3c802be |
|
MD5 | 016aa693f0843e70fd00fb5bada58b08 |
|
BLAKE2b-256 | 4a359c96d76ac759f0ff426365b195f2b599bad2288b58534c83b90cf5f05e18 |