Module utils

Module utils 

Source
Expand description

Message utility helpers

This module provides convenient helper functions for common message operations.

Functionsยง

can_retry
Check if a message should be retried based on retry count
clone_with_new_id
Clone a message with a new task ID (useful for retries or re-queuing)
create_retry_message
Create a retry message with incremented retry count
exponential_backoff
Calculate exponential backoff delay for retries
filter_by_task
Filter messages by task name pattern
group_by_task
Group messages by task name
is_message_expired
Check if a message is expired based on current time
is_ready_to_execute
Check if a message should be executed now (ETA has passed)
message_age
Calculate the age of a message based on its ETA or expires timestamp
sort_by_eta
Sort messages by ETA (earliest first)
sort_by_priority
Sort messages by priority (highest first)
time_until_eta
Get the time remaining until a message should be executed
time_until_expiration
Get the time remaining until a message expires
validate_batch
Validate multiple messages in batch