Celery Skinos
Custom consumer for celery integration.
Usage
from skinos.custom_consumer import CustomConsumer
Define a new exchange
defined a new exchange with a name and a binding key (always a topic). The exchange name must be unique.
# add_exchange(str, str) -> Exchange
CustomConsumer.add_exchange('test', "test.*.*")
Define a new task
Define a new message handler
decoration take 3 arguments:
- exchange name (must be defined)
- queue name (must be defined)
- queue binding key
Function but have this prototype: (str, Message) -> Any
bodyis the payloadmsgis the message object (kombu.transport.myamqp.Message)
# consumer(str, str, str) -> Callable[[str, Message], Any]
@CustomConsumer.consumer('test', 'test.test', 'test.test.*')
def coucou(body, msg):
print('payload content : {}'.format(body))
print('message object content : {}'.format(msg))
Build consumers for Celery integration
Build consumers itself. all previous methods are just a pre-configuration for this build. It take one argument, which is the Celery app.
# build(Celery) -> None
CustomConsumer.build(app)
Add Sentry handler
You must init Sentry normally for a Celery project. Then Skinos is able to catch exception and send it sentry.
set sentry to True and set raise to False (i.e: if error occur, error is not re-raise, but ignored) if you don't use it, default values are False and False
# with_sentry(bool, bool) -> Tuple(bool, bool)
CustomConsumer.with_sentry(False, False)
Run celery
Run celery normally
Release files for celery-skinos 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| celery-skinos-1.0.4.tar.gz | 4.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| celery_skinos-1.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.3 kB
Release files / celery-skinos-1.0.4.tar.gz
| Download URL | celery-skinos-1.0.4.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5f6a7ce5762478e866af1cca4bb3230498b3910c5837e49adb4c5677048c0007
|
|
BLAKE2b-256 checksum How to use checksums |
02be857d090062eda3f39b3a0a76e0b35844fd0500cf049838aa95d7958f81a6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.0 CPython/3.10.6 Darwin/20.6.0
|
Release files / celery_skinos-1.0.4-py3-none-any.whl
| Download URL | celery_skinos-1.0.4-py3-none-any.whl |
|---|---|
| Size | 4.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a2b4e1d8e36a198d1b72a96f3c70d8cd384fd448a488ee2662a2b00ff3d24170
|
|
BLAKE2b-256 checksum How to use checksums |
9c827c9041a1590fbadf6b4332d1bc6a6c5a080f539f2f2671dfb9ced4d6b412
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.0 CPython/3.10.6 Darwin/20.6.0
|