No project description provided
Project description
Romeways memory queue
This is an extra package for romeways for more details access the romeways Github page.
Configs
Queue
The only difference between the romeways.GenericQueueConfig
and romeways_memory_queue.MemoryQueueConfig
are some default parameters.
from dataclasses import dataclass, field
from romeways import GenericQueueConfig
@dataclass(slots=True, frozen=True)
class MemoryQueueConfig(GenericQueueConfig):
connector_name: str
frequency: float = field(default=0.25)
max_chunk_size: int = field(default=10)
sequential: bool = field(default=False)
Connector
Obs: Because the package use the multiprocessing.Queue is allowed to register only one queue consumer.
from dataclasses import dataclass
from multiprocessing import Queue
from romeways import GenericConnectorConfig
@dataclass(slots=True, frozen=True)
class MemoryConnectorConfig(GenericConnectorConfig):
connector_name: str
queue: Queue
Use case
from multiprocessing import Queue
import romeways
# Create a queue config
config_q = romeways.MemoryQueueConfig(
connector_name="memory-dev1"
)
# Register a controller/consumer for the queue name
@romeways.queue_consumer(queue_name="queue.payment.done", config=config_q)
async def controller(message: romeways.Message):
print(message)
# Config the connector
queue = Queue()
config_p = romeways.MemoryConnectorConfig(connector_name="memory-dev1", queue=queue)
# Register a connector
romeways.connector_register(
connector=romeways.MemoryQueueConnector, config=config_p, spawn_process=True
)
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
Built Distribution
Close
Hashes for romeways_memory_queue-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ca4e93988e0e4e025460c17f259f58e7e2faf89ed14bbccf3cff3cd6adfa754 |
|
MD5 | a1b3ea785af36ed69f33902367e60fe8 |
|
BLAKE2b-256 | bd159f2c48f84a4dfbe9730719592c170853d98ea589b5030e226b53b1cd759f |
Close
Hashes for romeways_memory_queue-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b8cb497743aef2c330a04be21e435beb0251bcb87f4985868a4239d3066b9253 |
|
MD5 | e6450e482266b191131e47a70e200f20 |
|
BLAKE2b-256 | 8ab79038da7f5eb7831ef43c4d678c3a99b4c4630c827d4f323d7fa7fd604092 |