Skip to content

Commit 2b402f4

Browse files
committed
Add MQResponse model to define parameters used in NeonGeckoCom/neon_mq_connector#101
1 parent 3ecbd9a commit 2b402f4

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

neon_data_models/models/base/contexts.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,5 +93,9 @@ class KlatContext(BaseModel):
9393

9494

9595
class MQContext(BaseModel):
96+
"""
97+
MQ context information that is included in all MQ message bodies and in
98+
`Message.context['MQ']` for Message objects originating at MQ handlers.
99+
"""
96100
routing_key: Optional[str] = None
97101
message_id: str

neon_data_models/models/base/mq.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# NEON AI (TM) SOFTWARE, Software Development Kit & Application Development System
2+
# All trademark and other rights reserved by their respective owners
3+
# Copyright 2008-2024 Neongecko.com Inc.
4+
# BSD-3
5+
# Redistribution and use in source and binary forms, with or without
6+
# modification, are permitted provided that the following conditions are met:
7+
# 1. Redistributions of source code must retain the above copyright notice,
8+
# this list of conditions and the following disclaimer.
9+
# 2. Redistributions in binary form must reproduce the above copyright notice,
10+
# this list of conditions and the following disclaimer in the documentation
11+
# and/or other materials provided with the distribution.
12+
# 3. Neither the name of the copyright holder nor the names of its
13+
# contributors may be used to endorse or promote products derived from this
14+
# software without specific prior written permission.
15+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
17+
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18+
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
19+
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20+
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21+
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
22+
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
23+
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24+
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25+
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26+
27+
from typing import Optional
28+
from pydantic import Field
29+
from neon_data_models.models.base.contexts import MQContext
30+
31+
32+
class MQResponse(MQContext):
33+
is_final: bool = Field(default=True, alias="_is_final",
34+
description='If False, another response message is '
35+
'expected.')
36+
part: Optional[int] = Field(default=None, alias="_part",
37+
description='Index of this response message in '
38+
'a series. (zero-indexed)')

0 commit comments

Comments
 (0)