Skip to main content

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 is the multiprocessing.Queue instance.

from dataclasses import dataclass
from multiprocessing import Queue

from romeways import GenericQueueConfig


@dataclass(slots=True, frozen=True)
class MemoryQueueConfig(GenericQueueConfig):
    connector_name: str
    frequency: float
    max_chunk_size: int
    sequential: bool
    queue: Queue

Connector

from dataclasses import dataclass

from romeways import GenericConnectorConfig

@dataclass(slots=True, frozen=True)
class MemoryConnectorConfig(GenericConnectorConfig):
    connector_name: str

Use case

from multiprocessing import Queue
import asyncio

import romeways

# Config the connector
queue = Queue()

# Create a queue config
config_q = romeways.MemoryQueueConfig(
    connector_name="memory-dev1",
    frequency=1,
    max_chunk_size=10,
    sequential=False,
    queue=queue
)

# 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_p = romeways.MemoryConnectorConfig(connector_name="memory-dev1")

# Register a connector
romeways.connector_register(
    connector=romeways.MemoryQueueConnector, config=config_p, spawn_process=True
)

asyncio.run(romeways.start())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

romeways_memory_queue-0.2.0.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

romeways_memory_queue-0.2.0-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file romeways_memory_queue-0.2.0.tar.gz.

File metadata

  • Download URL: romeways_memory_queue-0.2.0.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.10.6 Linux/5.19.0-41-generic

File hashes

Hashes for romeways_memory_queue-0.2.0.tar.gz
Algorithm Hash digest
SHA256 757df7e2a5d088cc675ce35212a1150fd3ffe249ae6c14e14beb21265b6ba692
MD5 7fa15a4d042de96acf437cad3eb6148f
BLAKE2b-256 ca39cc3080921c5e49e8641dd4bfb1a6fe29c121c76356e4ba3a46e5a86de02d

See more details on using hashes here.

File details

Details for the file romeways_memory_queue-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for romeways_memory_queue-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 694ef9b233150dde27f24537f4fc48e1f9b9014a75633e9e636128430eb447a8
MD5 df22769127f8ce0aaec8a9fadf96e922
BLAKE2b-256 13c0202b143fc09a3d13a022eac877156eceddf7f0736c3b603b76a55eb00cc9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page