Visibility Timeout¶
The visibility timeout (VT) determines how long a message remains invisible to other consumers after being read. If the consumer does not delete or archive the message before the VT expires, the message becomes visible again.
Set VT for a Single Message¶
Returns the updated Message object.
Set VT for Multiple Messages¶
Returns a list[Message].
Set VT to a Specific Timestamp¶
Instead of an integer number of seconds, you can pass a datetime to set an absolute expiration:
from datetime import datetime, timezone, timedelta
future = datetime.now(timezone.utc) + timedelta(minutes=10)
updated = queue.set_vt("my_queue", msg_id=42, vt=future)
Behavior Notes¶
set_vtis transactional. If the operation fails, no changes are applied.- The returned
Message.vtreflects the new expiration time. - Use this to implement "heartbeat" or "lease extension" patterns in long-running workers.