mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-04-25 16:36:21 +02:00
Refactor: Derive consumer behaviour from queue class (#772)
Derive consumer behaviour from queue class, remove 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.
This commit is contained in:
parent
aff96e57cb
commit
feeb92b33f
15 changed files with 93 additions and 95 deletions
|
|
@ -21,8 +21,8 @@ class TestQueueFunction:
|
|||
def test_response_class(self):
|
||||
assert queue('config', cls='response') == 'response:tg:config'
|
||||
|
||||
def test_state_class(self):
|
||||
assert queue('config', cls='state') == 'state:tg:config'
|
||||
def test_notify_class(self):
|
||||
assert queue('config', cls='notify') == 'notify:tg:config'
|
||||
|
||||
def test_custom_topicspace(self):
|
||||
assert queue('config', cls='request', topicspace='prod') == 'request:prod:config'
|
||||
|
|
@ -44,9 +44,9 @@ class TestPulsarMapTopic:
|
|||
assert backend.map_topic('flow:tg:text-completion-request') == \
|
||||
'persistent://tg/flow/text-completion-request'
|
||||
|
||||
def test_state_maps_to_persistent(self, backend):
|
||||
assert backend.map_topic('state:tg:config') == \
|
||||
'persistent://tg/state/config'
|
||||
def test_notify_maps_to_non_persistent(self, backend):
|
||||
assert backend.map_topic('notify:tg:config') == \
|
||||
'non-persistent://tg/notify/config'
|
||||
|
||||
def test_request_maps_to_non_persistent(self, backend):
|
||||
assert backend.map_topic('request:tg:config') == \
|
||||
|
|
@ -153,7 +153,7 @@ class TestQueueDefinitions:
|
|||
|
||||
def test_config_push(self):
|
||||
from trustgraph.schema.services.config import config_push_queue
|
||||
assert config_push_queue == 'flow:tg:config'
|
||||
assert config_push_queue == 'notify:tg:config'
|
||||
|
||||
def test_librarian_request(self):
|
||||
from trustgraph.schema.services.library import librarian_request_queue
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue