Skip to main content

enqueue_with_content

Function enqueue_with_content 

Source
pub async fn enqueue_with_content(
    pool: &Pool,
    agent_instance_hierarchy: Option<String>,
    agent_tag: Option<String>,
    sender_agent_instance_hierarchy: &str,
    key: Option<String>,
    content: RichContent,
) -> Result<i64, Error>
Expand description

Atomic enqueue: inserts the message_queue row, walks content and extracts every part into a per-kind table referenced by id, then UPDATEs the message_queue.content column with the assembled [ResponseContent] JSON (One(i64) for single-part, Many(Vec<i64>) for multi-part). Returns the new message_queue.id. Everything runs inside one transaction — failure rolls every content row back.