diff --git a/api-ref/source/samples/queue-create-request.json b/api-ref/source/samples/queue-create-request.json index 9c7a178e7..1f2cd71e9 100644 --- a/api-ref/source/samples/queue-create-request.json +++ b/api-ref/source/samples/queue-create-request.json @@ -2,5 +2,8 @@ "_max_messages_post_size": 262144, "_default_message_ttl": 3600, "_default_message_delay": 30, + "_dead_letter_queue": "dead_letter", + "_dead_letter_queue_messages_ttl": 3600, + "_max_claim_count": 10, "description": "Queue for international traffic billing." } \ No newline at end of file diff --git a/releasenotes/notes/return_reserved_metdata_for_dead_letter_queue-da160301f6d8cfa4.yaml b/releasenotes/notes/return_reserved_metdata_for_dead_letter_queue-da160301f6d8cfa4.yaml new file mode 100644 index 000000000..aeccd2e3a --- /dev/null +++ b/releasenotes/notes/return_reserved_metdata_for_dead_letter_queue-da160301f6d8cfa4.yaml @@ -0,0 +1,6 @@ +--- +features: + - Add three new reserved metdata in response body of querying queue. + "_dead_letter_queue", "_dead_letter_queue_messages_ttl" and + "_max_claim_count". Those metadata will help user to know better about + dead letter queue. diff --git a/zaqar/tests/unit/transport/wsgi/v2_0/test_queue_lifecycle.py b/zaqar/tests/unit/transport/wsgi/v2_0/test_queue_lifecycle.py index 9e7d0f856..f8482c871 100644 --- a/zaqar/tests/unit/transport/wsgi/v2_0/test_queue_lifecycle.py +++ b/zaqar/tests/unit/transport/wsgi/v2_0/test_queue_lifecycle.py @@ -110,6 +110,9 @@ class TestQueueLifecycleMongoDB(base.V2Base): ref_doc['_default_message_ttl'] = 3600 ref_doc['_max_messages_post_size'] = 262144 ref_doc['_default_message_delay'] = 0 + ref_doc['_dead_letter_queue'] = None + ref_doc['_dead_letter_queue_messages_ttl'] = None + ref_doc['_max_claim_count'] = None self.assertEqual(ref_doc, result_doc) # Stats empty queue @@ -247,6 +250,9 @@ class TestQueueLifecycleMongoDB(base.V2Base): ref_doc['_default_message_ttl'] = 3600 ref_doc['_max_messages_post_size'] = 262144 ref_doc['_default_message_delay'] = 0 + ref_doc['_dead_letter_queue'] = None + ref_doc['_dead_letter_queue_messages_ttl'] = None + ref_doc['_max_claim_count'] = None self.assertEqual(ref_doc, result_doc) self.assertEqual(falcon.HTTP_200, self.srmock.status) @@ -301,7 +307,10 @@ class TestQueueLifecycleMongoDB(base.V2Base): self.assertEqual({'key1': 2, 'key2': 1, '_default_message_ttl': 300, '_max_messages_post_size': 262144, - '_default_message_delay': 0}, result_doc) + '_default_message_delay': 0, + '_dead_letter_queue': None, + '_dead_letter_queue_messages_ttl': None, + '_max_claim_count': None}, result_doc) # remove metadata doc3 = '[{"op":"remove", "path": "/metadata/key1"}]' @@ -323,7 +332,10 @@ class TestQueueLifecycleMongoDB(base.V2Base): result_doc = jsonutils.loads(result[0]) self.assertEqual({'key2': 1, '_default_message_ttl': 3600, '_max_messages_post_size': 262144, - '_default_message_delay': 0}, result_doc) + '_default_message_delay': 0, + '_dead_letter_queue': None, + '_dead_letter_queue_messages_ttl': None, + '_max_claim_count': None}, result_doc) # replace non-existent metadata doc4 = '[{"op":"replace", "path": "/metadata/key3", "value":2}]' @@ -438,7 +450,10 @@ class TestQueueLifecycleMongoDB(base.V2Base): self.assertEqual(queue['metadata'], result_doc) self.assertEqual({'node': 31, '_default_message_ttl': 3600, '_max_messages_post_size': 262144, - '_default_message_delay': 0}, result_doc) + '_default_message_delay': 0, + '_dead_letter_queue': None, + '_dead_letter_queue_messages_ttl': None, + '_max_claim_count': None}, result_doc) # List tail self.simulate_get(target, headers=header, query_string=params) diff --git a/zaqar/transport/wsgi/v2_0/queues.py b/zaqar/transport/wsgi/v2_0/queues.py index e95d23d4a..aad940106 100644 --- a/zaqar/transport/wsgi/v2_0/queues.py +++ b/zaqar/transport/wsgi/v2_0/queues.py @@ -37,6 +37,10 @@ def _get_reserved_metadata(validate): validate.get_limit_conf_value(meta) for meta in _reserved_metadata } + + for metadata in ['_dead_letter_queue', '_dead_letter_queue_messages_ttl', + '_max_claim_count']: + reserved_metadata.update({metadata: None}) return reserved_metadata