Skip to main content

prefect.server.utilities.messaging.memory

Functions

log_metrics_periodically

update_metric

break_topic

ephemeral_subscription

Classes

MemoryMessage

Subscription

A subscription to a topic. Messages are delivered to the subscription’s queue and retried up to a maximum number of times. If a message cannot be delivered after the maximum number of retries it is moved to the dead letter queue. The dead letter queue is a directory of JSON files containing the serialized message. Messages remain in the dead letter queue until they are removed manually. Attributes:
  • topic: The topic that the subscription receives messages from.
  • max_retries: The maximum number of times a message will be retried for this subscription.
  • dead_letter_queue_path: The path to the dead letter queue folder.
Methods:

deliver

Deliver a message to the subscription’s queue. Args:
  • message: The message to deliver.

get

Get a message from the subscription’s queue.

retry

Place a message back on the retry queue. If the message has retried more than the maximum number of times it is moved to the dead letter queue. Args:
  • message: The message to retry.

send_to_dead_letter_queue

Send a message to the dead letter queue. The dead letter queue is a directory of JSON files containing the serialized messages. Args:
  • message: The message to send to the dead letter queue.

Topic

Methods:

by_name

clear

clear_all

publish

subscribe

unsubscribe

Cache

Methods:

clear_recently_seen_messages

forget_duplicates

without_duplicates

Publisher

Methods:

publish_data

Consumer

Methods:

cleanup

Cleanup resources by unsubscribing from the topic. This should be called when the consumer is no longer needed to prevent memory leaks from orphaned subscriptions.

run