merupakan package khusus django untuk keperluan berkomunikasi dengan rabbitmq
Quick start
Tambahkan “aiga_amqp” ke INSTALLED_APPS pada file settings.py:
INSTALLED_APPS = [ ... 'aiga_amqp', ]
A.1 Message Sender
Berikut contoh kode untuk mengirim message:
from aiga_amqp.core import send_queue
send_queue('nama channel', message='ini pesan')
A.2 Compete Consumer
Berikut merupakan langkah untuk consume antrian message secara “compete” atau bergantian.
Pada folder app yang anda inginkan, tambahkan file consumer.py
Pada file consumer.py buat function untuk menangani message seperti contoh dibawah ini:
def consumer(channel, method, properties, body): print('saya telah baru saja melakukan sesuatu hal yang penting disini ...')Pada file apps.py override method ready dan lakukan perintah seperti contoh berikut untuk mengeksekusi consumer.py:
from django.apps import AppConfig class ExampleConfig(AppConfig): default_auto_field = 'django.db.models.BigAutoField' name = 'example' def ready(self) -> None: from aiga_amqp.core import AMQPListener from .consumer import consumer listener = AMQPListener() listener.consume(consumer, channel_name='your channel name')
Jalankan django
B.1 Publish Message
segera
B.2 Subscribe Message
segera
Settings Variable
Terdapat beberapa variable yang bisa digunakan pada settings.py beserta default value nya:
AIGA_AMQP = {
'HOST' : 'localhost', //alamat host dari rabbitmq
'PORT' : 5672, //port dari rabbitmq
'CREDENTIAL' : False, //set menjadi True jika menggunakan USERNAME dan PASSWORD
'USERNAME' : None, //username untuk mengakses rabbitmq
'PASSWORD' : None, //password untuk mengakses rabbitmq
'HEARTBEAT' : 600,
'TIMEOUT' : 300
}
Metadata
Release files for aiga-django-amqp 0.0.2
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 | Actions |
|---|---|---|---|---|
| aiga-django-amqp-0.0.2.tar.gz | 4.6 kB | Without provenance | Details for aiga-django-amqp-0.0.2.tar.gz |
Release files / aiga-django-amqp-0.0.2.tar.gz
| Download URL | aiga-django-amqp-0.0.2.tar.gz |
|---|---|
| Size | 4.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bb8a8e79b6bbea21891b18ae78e1006c013b7d994674f18567bab6c6979cd6a6
|
|
BLAKE2b-256 checksum How to use checksums |
8cb4d37879eb07c6dbaffd8a90ce9caf3466d5bd6b7a4fbc94214f28fe7c1fa0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.0
|
Security for aiga-django-amqp 0.0.2
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.