Skip to main content

Memphis broker for taskiq

Project description

taskiq-memphis

This library provides you with memphis broker for taskiq. You need python version >=3.8

Usage:

from taskiq_memphis import MemphisBroker

broker = MemphisBroker(
    memphis_host="localhost",
    username="root",
    password="memphis",
)


@broker.task
async def the_best_task_ever() -> None:
    print("The best task ever")

Configuration

MemphisBroker parameters:

  • memphis_host - host to memphis.
  • port - memphis server port.
  • username - username.
  • connection_token - connection token.
  • password - password for username.
  • result_backend - custom result backend.
  • task_id_generator - custom task_id genertaor.
  • reconnect - turn on/off reconnection while connection is lost.
  • max_reconnect - maximum reconnection attempts.
  • reconnect_interval_ms - interval in milliseconds between reconnect attempts.
  • timeout_ms - connection timeout in milliseconds.
  • cert_file - path to tls cert file.
  • key_file - path to tls key file.
  • ca_file - path to tls ca file.
  • consumer_batch_size - batch size for the consumer.
  • destroy_station_on_shutdown - close station on shutdown.
  • destroy_producer_on_shutdown - close producer on shutdown.
  • destroy_consumer_on_shutdown - close consumer on shutdown.

Non-obvious things

You can configure memphis topic, consumer, producer and produce method with:

# Create broker
broker = MemphisBroker(
    memphis_host="localhost",
    username="root",
    password="memphis",
    destroy_station_on_shutdown=True,
)

# Configure station
broker.configure_station(...)

# Configure producer
broker.configure_producer(...)

# Configure produce method
broker.configure_produce_method(...)

# Configure consumer
broker.configure_consumer(...)

Memphis station parameters you can configure:

  • name - name of the station. Required.
  • retention_type - type of message retention.
  • retention_value - how long it takes to keep message, based on retention_type.
  • storage_type - type of the storage, DISK or MEMORY.
  • replicas - number of replicas.
  • idempotency_window_ms - time frame in which idempotent messages will be tracked.
  • schema_name - name of the schema. (You can create it only via memphis UI now)
  • send_poison_msg_to_dls - send poisoned message to dead letter station or not.
  • send_schema_failed_msg_to_dls - send schema failed message to dead letter station or not.
  • tiered_storage_enabled - tiered storage enabled or not.

Memphis producer parameters you can configure:

  • producer_name - producer name. Required.
  • generate_random_suffix - add suffix to producer name. Default - True. DON'T SET THIS VARIABLE TO FALSE IF YOU WANT TO USE MORE THAN ONE PRODUCER.

Memphis produce method parameters you can configure:

  • ack_wait_sec - wait ack time in seconds.
  • headers - Headers instance from memphis.
  • async_produce - produce message in async way or not.

Memphis consumer parameters you can configure:

  • consumer_name - name of the consumer. Required.
  • consumer_group - name of the consumer group.
  • pull_interval_ms - interval in milliseconds between pulls.
  • batch_size - pull batch size.
  • batch_max_time_to_wait_ms - max time in milliseconds to wait between pulls.
  • max_ack_time_ms - max time for ack a message in milliseconds.
  • max_msg_deliveries - max number of message deliveries.
  • generate_random_suffix - concatenate a random suffix to consumer's name. DON'T SET THIS VARIABLE TO FALSE IF YOU WANT TO USE MORE THAN ONE CONSUMER.
  • start_consume_from_sequence - start consuming from a specific sequence.
  • last_messages - consume the last N messages.

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

taskiq_memphis-0.2.0.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

taskiq_memphis-0.2.0-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: taskiq_memphis-0.2.0.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.6 Linux/5.15.0-1038-azure

File hashes

Hashes for taskiq_memphis-0.2.0.tar.gz
Algorithm Hash digest
SHA256 47bd6e737733f0e97dd965e1fef5b37d9f4015316d7fa5cb3250077ef08232e5
MD5 d0cbacb97582f7adab5c24e724a0292b
BLAKE2b-256 1ab1238e44ad6256fd07a11a6e180f24d4654e0cbef0b197f07fb25dc442ba61

See more details on using hashes here.

File details

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

File metadata

  • Download URL: taskiq_memphis-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.6 Linux/5.15.0-1038-azure

File hashes

Hashes for taskiq_memphis-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 29dd06407136f55452470ac737cb82b6624b987c526dde1a533dfe8966c8399c
MD5 083e995cc4ea4e2432a49a5106c7a435
BLAKE2b-256 b6128691cb405ae496ba1f4df463d814cdcf59bda90719ec6eb4e34d1156a67b

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