mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-08 21:02:12 +02:00
consumer_type parameter The queue class prefix (flow, request, response, notify) now fully determines consumer behaviour in both RabbitMQ and Pulsar backends. Added 'notify' class for ephemeral broadcast (config push notifications). Response and notify classes always create per-subscriber auto-delete queues, eliminating orphaned queues that accumulated on service restarts. Change init-trustgraph to set up the 'notify' namespace in Pulsar instead of old hangover 'state'. Fixes 'stuck backlog' on RabbitMQ config notification queue.
26 lines
986 B
Python
26 lines
986 B
Python
|
|
def queue(topic, cls='flow', topicspace='tg'):
|
|
"""
|
|
Create a queue identifier in CLASS:TOPICSPACE:TOPIC format.
|
|
|
|
Args:
|
|
topic: The logical queue name (e.g. 'config', 'librarian')
|
|
cls: Queue class determining operational characteristics:
|
|
- 'flow' = persistent shared work queue (competing consumers)
|
|
- 'request' = non-persistent RPC request queue (shared)
|
|
- 'response' = non-persistent RPC response queue (per-subscriber)
|
|
- 'notify' = ephemeral broadcast (per-subscriber, auto-delete)
|
|
topicspace: Deployment isolation prefix (default: 'tg')
|
|
|
|
Returns:
|
|
Queue identifier string: cls:topicspace:topic
|
|
|
|
Examples:
|
|
queue('text-completion-request')
|
|
# flow:tg:text-completion-request
|
|
queue('config', cls='request')
|
|
# request:tg:config
|
|
queue('config', cls='notify')
|
|
# notify:tg:config
|
|
"""
|
|
return f"{cls}:{topicspace}:{topic}"
|