mq-bridge-basic 0.4.17__cp38-abi3-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mq_bridge/__init__.py +92 -0
- mq_bridge/__init__.pyi +351 -0
- mq_bridge/_mq_bridge.pyd +4 -0
- mq_bridge/config.py +180 -0
- mq_bridge/config.pyi +743 -0
- mq_bridge/plugin_packaging.py +90 -0
- mq_bridge/py.typed +1 -0
- mq_bridge_basic-0.4.17.dist-info/METADATA +427 -0
- mq_bridge_basic-0.4.17.dist-info/RECORD +15 -0
- mq_bridge_basic-0.4.17.dist-info/WHEEL +4 -0
- mq_bridge_basic-0.4.17.dist-info/licenses/LICENSE-APACHE.python +201 -0
- mq_bridge_basic-0.4.17.dist-info/licenses/LICENSE-MIT.python +21 -0
- mq_bridge_basic-0.4.17.dist-info/licenses/LICENSE.python +19 -0
- mq_bridge_basic-0.4.17.dist-info/licenses/THIRD_PARTY_LICENSES.txt +4482 -0
- mq_bridge_basic-0.4.17.dist-info/sboms/mq-bridge-py.cyclonedx.json +18340 -0
mq_bridge/__init__.py
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import platform
|
|
3
|
+
import sys
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from typing import Union
|
|
6
|
+
|
|
7
|
+
from ._mq_bridge import (
|
|
8
|
+
Consumer,
|
|
9
|
+
MemoryDrainer,
|
|
10
|
+
Message,
|
|
11
|
+
NonRetryableError,
|
|
12
|
+
Publisher,
|
|
13
|
+
RetryableError,
|
|
14
|
+
Route,
|
|
15
|
+
__version__,
|
|
16
|
+
config_schema,
|
|
17
|
+
init_logging,
|
|
18
|
+
is_shutdown_requested,
|
|
19
|
+
load_endpoint_plugin,
|
|
20
|
+
register_endpoint,
|
|
21
|
+
register_middleware,
|
|
22
|
+
request_shutdown,
|
|
23
|
+
unregister_endpoint,
|
|
24
|
+
unregister_middleware,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def _plugin_platform_tag() -> str:
|
|
29
|
+
machine = platform.machine().lower()
|
|
30
|
+
arch = {"aarch64": "arm64", "amd64": "x64", "x86_64": "x64"}.get(machine, machine)
|
|
31
|
+
suffix = "-gnu" if sys.platform == "linux" else "-msvc" if sys.platform == "win32" else ""
|
|
32
|
+
return f"{sys.platform}-{arch}{suffix}"
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def plugin_library_path(package: Union[str, Path]) -> str:
|
|
36
|
+
"""Resolve the native library in an installed mq-bridge plugin package."""
|
|
37
|
+
root = Path(package).resolve()
|
|
38
|
+
if root.is_file():
|
|
39
|
+
root = root.parent
|
|
40
|
+
manifest_path = root / "mq-bridge-plugin.json"
|
|
41
|
+
if not manifest_path.is_file():
|
|
42
|
+
raise FileNotFoundError(f"mq-bridge plugin manifest not found: {manifest_path}")
|
|
43
|
+
manifest = json.loads(manifest_path.read_text(encoding="utf-8"))
|
|
44
|
+
try:
|
|
45
|
+
library = manifest["library"]
|
|
46
|
+
name = manifest["name"]
|
|
47
|
+
except KeyError as error:
|
|
48
|
+
raise ValueError(f"{manifest_path} must contain 'name' and 'library'") from error
|
|
49
|
+
if not isinstance(name, str) or not isinstance(library, str):
|
|
50
|
+
raise ValueError(f"{manifest_path} must contain string fields 'name' and 'library'")
|
|
51
|
+
file_name = (
|
|
52
|
+
f"{library}.dll"
|
|
53
|
+
if sys.platform == "win32"
|
|
54
|
+
else f"lib{library}.dylib"
|
|
55
|
+
if sys.platform == "darwin"
|
|
56
|
+
else f"lib{library}.so"
|
|
57
|
+
)
|
|
58
|
+
candidates = (root / "prebuilds" / _plugin_platform_tag() / file_name, root / file_name)
|
|
59
|
+
for candidate in candidates:
|
|
60
|
+
if candidate.is_file():
|
|
61
|
+
return str(candidate)
|
|
62
|
+
raise FileNotFoundError(
|
|
63
|
+
f"no native library for {_plugin_platform_tag()} in mq-bridge plugin package {root}; "
|
|
64
|
+
f"looked in {', '.join(map(str, candidates))}"
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def load_plugin_package(package: Union[str, Path]) -> str:
|
|
69
|
+
"""Resolve and load the native library in an mq-bridge plugin package."""
|
|
70
|
+
return load_endpoint_plugin(plugin_library_path(package))
|
|
71
|
+
|
|
72
|
+
__all__ = [
|
|
73
|
+
"Consumer",
|
|
74
|
+
"MemoryDrainer",
|
|
75
|
+
"Message",
|
|
76
|
+
"NonRetryableError",
|
|
77
|
+
"Publisher",
|
|
78
|
+
"RetryableError",
|
|
79
|
+
"Route",
|
|
80
|
+
"__version__",
|
|
81
|
+
"config_schema",
|
|
82
|
+
"init_logging",
|
|
83
|
+
"is_shutdown_requested",
|
|
84
|
+
"load_endpoint_plugin",
|
|
85
|
+
"load_plugin_package",
|
|
86
|
+
"plugin_library_path",
|
|
87
|
+
"register_endpoint",
|
|
88
|
+
"register_middleware",
|
|
89
|
+
"request_shutdown",
|
|
90
|
+
"unregister_endpoint",
|
|
91
|
+
"unregister_middleware",
|
|
92
|
+
]
|
mq_bridge/__init__.pyi
ADDED
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
from types import TracebackType
|
|
2
|
+
from typing import Any, Callable, Dict, Iterable, List, Mapping, Optional, Tuple, Type, Union
|
|
3
|
+
|
|
4
|
+
__version__: str
|
|
5
|
+
|
|
6
|
+
def config_schema() -> Dict[str, Any]:
|
|
7
|
+
"""Return the route-config JSON Schema, generated from the Rust models."""
|
|
8
|
+
...
|
|
9
|
+
|
|
10
|
+
def init_logging(level: Optional[str] = ...) -> None:
|
|
11
|
+
"""Route the library's internal ``tracing`` events into the standard
|
|
12
|
+
``logging`` module. Call once at startup, then configure output with
|
|
13
|
+
``logging`` as usual (``logging.basicConfig``, handlers, formatters).
|
|
14
|
+
|
|
15
|
+
``level`` seeds the Rust-side filter (default ``"warn"``); the
|
|
16
|
+
``MQ_BRIDGE_LOG`` / ``RUST_LOG`` environment variables override it.
|
|
17
|
+
Filtering happens in Rust, so suppressed events never cross into Python.
|
|
18
|
+
Raises if logging was already initialized."""
|
|
19
|
+
...
|
|
20
|
+
|
|
21
|
+
def request_shutdown() -> bool:
|
|
22
|
+
"""Request a graceful shutdown of every route: running ones stop, and ones
|
|
23
|
+
started afterwards stop immediately. Wire it to your own signal handling,
|
|
24
|
+
e.g. ``signal.signal(signal.SIGTERM, lambda *_: request_shutdown())``.
|
|
25
|
+
Returns ``True`` only for the first request. It cannot be undone."""
|
|
26
|
+
...
|
|
27
|
+
|
|
28
|
+
def is_shutdown_requested() -> bool:
|
|
29
|
+
"""``True`` once :func:`request_shutdown` has been called."""
|
|
30
|
+
...
|
|
31
|
+
|
|
32
|
+
def register_endpoint(
|
|
33
|
+
name: str, factory: Callable[[str, Dict[str, Any]], Any]
|
|
34
|
+
) -> None:
|
|
35
|
+
"""Register a custom endpoint implemented in Python under ``name``, making it
|
|
36
|
+
usable as an endpoint type in route configs — either as ``{"pulsar": {...}}``
|
|
37
|
+
or explicitly as ``{"custom": {"name": "pulsar", "config": {...}}}``.
|
|
38
|
+
|
|
39
|
+
``factory`` is called as ``factory(route_name, config)`` once per route leg.
|
|
40
|
+
It must return an object implementing ``receive_batch(max_messages)`` to be
|
|
41
|
+
usable as an input and/or ``send_batch(messages)`` to be usable as an output,
|
|
42
|
+
plus optional ``commit(dispositions)`` and ``close()``.
|
|
43
|
+
|
|
44
|
+
``receive_batch`` returns an iterable of ``Message``/bytes/str/JSON values,
|
|
45
|
+
or ``None``/``[]`` when nothing is available right now; raise
|
|
46
|
+
``StopIteration`` to signal end of stream — that meaning applies only to
|
|
47
|
+
``receive_batch``; from any other method it is an ordinary error. ``commit``
|
|
48
|
+
receives a list of ``"ack"``/``"nack"`` strings, one per message in the batch.
|
|
49
|
+
|
|
50
|
+
Register before starting a route that names it; registering the same name
|
|
51
|
+
twice raises and keeps the first factory. All calls into one endpoint object
|
|
52
|
+
are serialized on its own thread, so it need not be thread-safe."""
|
|
53
|
+
...
|
|
54
|
+
|
|
55
|
+
def unregister_endpoint(name: str) -> bool:
|
|
56
|
+
"""Drop the endpoint factory registered under ``name``, releasing the
|
|
57
|
+
reference it holds on the Python factory object.
|
|
58
|
+
|
|
59
|
+
Returns ``True`` when a factory was removed, ``False`` when ``name`` was not
|
|
60
|
+
registered. Call only after every route using the endpoint has stopped;
|
|
61
|
+
routes already holding an instance keep running."""
|
|
62
|
+
...
|
|
63
|
+
|
|
64
|
+
def register_middleware(
|
|
65
|
+
name: str, factory: Callable[[str, Dict[str, Any]], Any]
|
|
66
|
+
) -> None:
|
|
67
|
+
"""Register a custom middleware implemented in Python under ``name``, usable
|
|
68
|
+
in any endpoint's ``middlewares`` list as
|
|
69
|
+
``{"custom": {"name": name, "config": {...}}}``.
|
|
70
|
+
|
|
71
|
+
``factory`` is called as ``factory(route_name, config)`` once per endpoint
|
|
72
|
+
the middleware is attached to. It must return an object implementing
|
|
73
|
+
``on_receive(messages)`` (applies on an input endpoint) and/or
|
|
74
|
+
``on_send(messages)`` (applies on an output endpoint); a side the object does
|
|
75
|
+
not implement passes through untouched.
|
|
76
|
+
|
|
77
|
+
Both hooks receive the batch and must return one item per input message: a
|
|
78
|
+
``Message`` (kept, possibly rewritten) or ``None`` to drop it. Keeping the
|
|
79
|
+
length fixed is what lets acknowledgements stay aligned with the source
|
|
80
|
+
batch."""
|
|
81
|
+
...
|
|
82
|
+
|
|
83
|
+
def unregister_middleware(name: str) -> bool:
|
|
84
|
+
"""Drop the middleware factory registered under ``name``, releasing the
|
|
85
|
+
reference it holds on the Python factory object.
|
|
86
|
+
|
|
87
|
+
Returns ``True`` when a factory was removed, ``False`` when ``name`` was not
|
|
88
|
+
registered. Call only after every route using the middleware has stopped."""
|
|
89
|
+
...
|
|
90
|
+
|
|
91
|
+
JsonValue = Any
|
|
92
|
+
HandlerResult = Optional[Union["Message", bytes, str, Dict[str, JsonValue], List[JsonValue], int, float, bool]]
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
class RetryableError(Exception): ...
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
class NonRetryableError(Exception): ...
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
class Message:
|
|
102
|
+
"""A message payload with optional metadata and id.
|
|
103
|
+
|
|
104
|
+
``id`` accepts a UUID string, a ``0x``-prefixed hex literal, or a decimal
|
|
105
|
+
integer. Any other string is hashed to a stable id rather than rejected, so
|
|
106
|
+
an arbitrary string no longer raises ``ValueError``; equal strings always
|
|
107
|
+
yield the same id.
|
|
108
|
+
"""
|
|
109
|
+
|
|
110
|
+
def __init__(
|
|
111
|
+
self,
|
|
112
|
+
payload: bytes,
|
|
113
|
+
metadata: Optional[Mapping[str, str]] = ...,
|
|
114
|
+
id: Optional[str] = ...,
|
|
115
|
+
) -> None: ...
|
|
116
|
+
|
|
117
|
+
@classmethod
|
|
118
|
+
def from_json(
|
|
119
|
+
cls,
|
|
120
|
+
data: JsonValue,
|
|
121
|
+
metadata: Optional[Mapping[str, str]] = ...,
|
|
122
|
+
id: Optional[str] = ...,
|
|
123
|
+
) -> "Message": ...
|
|
124
|
+
|
|
125
|
+
@property
|
|
126
|
+
def payload(self) -> bytes: ...
|
|
127
|
+
|
|
128
|
+
@property
|
|
129
|
+
def metadata(self) -> Dict[str, str]: ...
|
|
130
|
+
|
|
131
|
+
@property
|
|
132
|
+
def id(self) -> Optional[str]: ...
|
|
133
|
+
|
|
134
|
+
def json(self) -> JsonValue: ...
|
|
135
|
+
|
|
136
|
+
def text(self) -> str: ...
|
|
137
|
+
|
|
138
|
+
def with_json(self, data: JsonValue) -> "Message": ...
|
|
139
|
+
|
|
140
|
+
def with_payload(self, payload: bytes) -> "Message": ...
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
class Route:
|
|
144
|
+
@classmethod
|
|
145
|
+
def from_file(cls, path: str, name: Optional[str] = ...) -> "Route": ...
|
|
146
|
+
|
|
147
|
+
@classmethod
|
|
148
|
+
def from_str(cls, text: str, name: Optional[str] = ...) -> "Route": ...
|
|
149
|
+
|
|
150
|
+
@classmethod
|
|
151
|
+
def from_config(
|
|
152
|
+
cls, config: Mapping[str, Any], name: Optional[str] = ...
|
|
153
|
+
) -> "Route": ...
|
|
154
|
+
|
|
155
|
+
# Deprecated: use from_file (emits DeprecationWarning at runtime).
|
|
156
|
+
@classmethod
|
|
157
|
+
def from_yaml(cls, path: str, name: Optional[str] = ...) -> "Route": ...
|
|
158
|
+
|
|
159
|
+
# Deprecated: use from_str (emits DeprecationWarning at runtime).
|
|
160
|
+
@classmethod
|
|
161
|
+
def from_yaml_str(cls, text: str, name: Optional[str] = ...) -> "Route": ...
|
|
162
|
+
|
|
163
|
+
def with_handler(self, handler: Callable[[Message], HandlerResult]) -> "Route": ...
|
|
164
|
+
|
|
165
|
+
def add_handler(
|
|
166
|
+
self,
|
|
167
|
+
kind: str,
|
|
168
|
+
handler: Callable[[JsonValue], HandlerResult],
|
|
169
|
+
) -> "Route": ...
|
|
170
|
+
|
|
171
|
+
def run(self) -> None:
|
|
172
|
+
"""Deploy and block the calling thread until ``stop()`` is called. A
|
|
173
|
+
``KeyboardInterrupt`` stops the route gracefully and is re-raised."""
|
|
174
|
+
...
|
|
175
|
+
|
|
176
|
+
def start(self) -> None:
|
|
177
|
+
"""Deploy on a background thread and return immediately."""
|
|
178
|
+
...
|
|
179
|
+
|
|
180
|
+
def join(self) -> None:
|
|
181
|
+
"""Block until a route started with ``start()`` has stopped. A
|
|
182
|
+
``KeyboardInterrupt`` stops the route gracefully and is re-raised."""
|
|
183
|
+
...
|
|
184
|
+
|
|
185
|
+
def stop(self) -> None: ...
|
|
186
|
+
|
|
187
|
+
def __enter__(self) -> "Route": ...
|
|
188
|
+
|
|
189
|
+
def __exit__(
|
|
190
|
+
self,
|
|
191
|
+
exc_type: Optional[Type[BaseException]],
|
|
192
|
+
exc_value: Optional[BaseException],
|
|
193
|
+
traceback: Optional[TracebackType],
|
|
194
|
+
) -> bool: ...
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
class Consumer:
|
|
198
|
+
@classmethod
|
|
199
|
+
def from_file(cls, path: str, name: Optional[str] = ...) -> "Consumer": ...
|
|
200
|
+
|
|
201
|
+
@classmethod
|
|
202
|
+
def from_str(cls, text: str, name: Optional[str] = ...) -> "Consumer": ...
|
|
203
|
+
|
|
204
|
+
@classmethod
|
|
205
|
+
def from_config(
|
|
206
|
+
cls, config: Mapping[str, Any], name: Optional[str] = ...
|
|
207
|
+
) -> "Consumer": ...
|
|
208
|
+
|
|
209
|
+
def poll(
|
|
210
|
+
self,
|
|
211
|
+
max: int = ...,
|
|
212
|
+
timeout_ms: Optional[int] = ...,
|
|
213
|
+
) -> List["Message"]:
|
|
214
|
+
"""Receive up to ``max`` messages without acking. Empty list once
|
|
215
|
+
``timeout_ms`` milliseconds elapse with nothing received, or when the
|
|
216
|
+
source is exhausted; omit ``timeout_ms`` to block until a message
|
|
217
|
+
arrives. The returned messages are acked by the next ``commit()`` call —
|
|
218
|
+
you must call it (see ``commit``)."""
|
|
219
|
+
...
|
|
220
|
+
|
|
221
|
+
def poll_batch(
|
|
222
|
+
self,
|
|
223
|
+
max: int = ...,
|
|
224
|
+
timeout_ms: Optional[int] = ...,
|
|
225
|
+
) -> Tuple[List["Message"], Optional[int]]:
|
|
226
|
+
"""Like ``poll()``, but also return the batch's token so it can be acked
|
|
227
|
+
or nacked individually with ``ack(token)`` / ``nack(token)`` — the shape a
|
|
228
|
+
``dlt`` resource wants (``poll → yield → commit load package →
|
|
229
|
+
ack(token)``). Returns ``(messages, token)``, or ``([], None)`` on timeout
|
|
230
|
+
or end-of-stream. Tokens stay outstanding until acked/nacked; ``commit()``
|
|
231
|
+
still acks every outstanding batch at once, so don't mix the two styles on
|
|
232
|
+
one consumer."""
|
|
233
|
+
...
|
|
234
|
+
|
|
235
|
+
def ack(self, token: int) -> None:
|
|
236
|
+
"""Ack a single batch by the token from ``poll_batch()``, advancing the
|
|
237
|
+
consumer offset for just that batch. Raises if the token is unknown
|
|
238
|
+
(already acked/nacked, or never polled)."""
|
|
239
|
+
...
|
|
240
|
+
|
|
241
|
+
def nack(self, token: Optional[int] = ...) -> None:
|
|
242
|
+
"""Negatively acknowledge so the broker can redeliver. With a ``token``,
|
|
243
|
+
nacks just that batch; without one, nacks every outstanding batch (oldest
|
|
244
|
+
first). On Kafka there is no per-message nack — this leaves the offset
|
|
245
|
+
unadvanced, so redelivery happens on the next run/rebalance, not at
|
|
246
|
+
once."""
|
|
247
|
+
...
|
|
248
|
+
|
|
249
|
+
def commit(self) -> None:
|
|
250
|
+
"""Ack every batch returned by ``poll()`` since the last ``commit()``,
|
|
251
|
+
advancing the consumer offset.
|
|
252
|
+
|
|
253
|
+
Calling this is required, not optional. Without it the offset never
|
|
254
|
+
advances (messages are re-delivered on the next run), most brokers stall
|
|
255
|
+
once their unacknowledged/prefetch window fills, and uncommitted batches
|
|
256
|
+
are held in memory so the process grows unbounded. To retry a failed
|
|
257
|
+
batch, simply don't commit it — it will be redelivered."""
|
|
258
|
+
...
|
|
259
|
+
|
|
260
|
+
def status(self) -> Dict[str, Any]:
|
|
261
|
+
"""Status snapshot for the underlying endpoint: ``healthy``, ``target``,
|
|
262
|
+
optional ``pending`` (broker backlog/lag where reported — Kafka offset
|
|
263
|
+
lag, AMQP queue depth, NATS JetStream ``num_pending``), optional
|
|
264
|
+
``capacity``/``error``, and ``details``. ``pending == 0`` is a precise
|
|
265
|
+
"caught up" signal; ``None`` where the broker exposes no backlog."""
|
|
266
|
+
...
|
|
267
|
+
|
|
268
|
+
def close(self) -> None:
|
|
269
|
+
"""Release the broker connection. Idempotent; ``poll()``/``status()``
|
|
270
|
+
raise afterwards. The context-manager form calls this on exit."""
|
|
271
|
+
...
|
|
272
|
+
|
|
273
|
+
@property
|
|
274
|
+
def exhausted(self) -> bool: ...
|
|
275
|
+
|
|
276
|
+
def __enter__(self) -> "Consumer": ...
|
|
277
|
+
|
|
278
|
+
def __exit__(
|
|
279
|
+
self,
|
|
280
|
+
exc_type: Optional[Type[BaseException]],
|
|
281
|
+
exc_value: Optional[BaseException],
|
|
282
|
+
traceback: Optional[TracebackType],
|
|
283
|
+
) -> bool: ...
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
class MemoryDrainer:
|
|
287
|
+
@classmethod
|
|
288
|
+
def from_topic(
|
|
289
|
+
cls,
|
|
290
|
+
topic: str,
|
|
291
|
+
capacity: int = ...,
|
|
292
|
+
) -> "MemoryDrainer": ...
|
|
293
|
+
|
|
294
|
+
def drain(
|
|
295
|
+
self,
|
|
296
|
+
count: int,
|
|
297
|
+
timeout: Optional[float] = ...,
|
|
298
|
+
batch_size: int = ...,
|
|
299
|
+
) -> int: ...
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
class Publisher:
|
|
303
|
+
@classmethod
|
|
304
|
+
def from_file(cls, path: str, name: Optional[str] = ...) -> "Publisher": ...
|
|
305
|
+
|
|
306
|
+
@classmethod
|
|
307
|
+
def from_str(cls, text: str, name: Optional[str] = ...) -> "Publisher": ...
|
|
308
|
+
|
|
309
|
+
@classmethod
|
|
310
|
+
def from_config(
|
|
311
|
+
cls, config: Mapping[str, Any], name: Optional[str] = ...
|
|
312
|
+
) -> "Publisher": ...
|
|
313
|
+
|
|
314
|
+
# Deprecated: use from_file (emits DeprecationWarning at runtime).
|
|
315
|
+
@classmethod
|
|
316
|
+
def from_yaml(cls, path: str, name: Optional[str] = ...) -> "Publisher": ...
|
|
317
|
+
|
|
318
|
+
# Deprecated: use from_str (emits DeprecationWarning at runtime).
|
|
319
|
+
@classmethod
|
|
320
|
+
def from_yaml_str(cls, text: str, name: Optional[str] = ...) -> "Publisher": ...
|
|
321
|
+
|
|
322
|
+
def send(
|
|
323
|
+
self,
|
|
324
|
+
message: Union[Message, bytes],
|
|
325
|
+
metadata: Optional[Mapping[str, str]] = ...,
|
|
326
|
+
) -> None: ...
|
|
327
|
+
|
|
328
|
+
def send_batch(
|
|
329
|
+
self,
|
|
330
|
+
messages: Iterable[Union[Message, bytes]],
|
|
331
|
+
) -> None: ...
|
|
332
|
+
|
|
333
|
+
def request(
|
|
334
|
+
self,
|
|
335
|
+
message: Union[Message, bytes],
|
|
336
|
+
metadata: Optional[Mapping[str, str]] = ...,
|
|
337
|
+
) -> Message: ...
|
|
338
|
+
|
|
339
|
+
def send_json(
|
|
340
|
+
self,
|
|
341
|
+
data: JsonValue,
|
|
342
|
+
metadata: Optional[Mapping[str, str]] = ...,
|
|
343
|
+
id: Optional[str] = ...,
|
|
344
|
+
) -> None: ...
|
|
345
|
+
|
|
346
|
+
def request_json(
|
|
347
|
+
self,
|
|
348
|
+
data: JsonValue,
|
|
349
|
+
metadata: Optional[Mapping[str, str]] = ...,
|
|
350
|
+
id: Optional[str] = ...,
|
|
351
|
+
) -> Message: ...
|
mq_bridge/_mq_bridge.pyd
ADDED
mq_bridge/config.py
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
# Generated by scripts/gen_config_types.py from mq-bridge.schema.json.
|
|
2
|
+
# Do not edit by hand; re-run the generator after changing the schema.
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
AggregateEntry = dict
|
|
7
|
+
AggregateMiddleware = dict
|
|
8
|
+
AmqpConfig = dict
|
|
9
|
+
AwsConfig = dict
|
|
10
|
+
BufferMiddleware = dict
|
|
11
|
+
ClickHouseConfig = dict
|
|
12
|
+
CompressionMiddleware = dict
|
|
13
|
+
CookieJarMiddleware = dict
|
|
14
|
+
DeadLetterQueueMiddleware = dict
|
|
15
|
+
DeduplicationMiddleware = dict
|
|
16
|
+
DelayMiddleware = dict
|
|
17
|
+
DetailedMappingRule = dict
|
|
18
|
+
DirSpoolConfig = dict
|
|
19
|
+
EncryptionConfig = dict
|
|
20
|
+
Endpoint = dict
|
|
21
|
+
FileConfig = dict
|
|
22
|
+
GrpcConfig = dict
|
|
23
|
+
HttpConfig = dict
|
|
24
|
+
IbmMqConfig = dict
|
|
25
|
+
IbmTlsConfig = dict
|
|
26
|
+
KafkaConfig = dict
|
|
27
|
+
LimiterMiddleware = dict
|
|
28
|
+
LookupEntry = dict
|
|
29
|
+
LookupMiddleware = dict
|
|
30
|
+
MemoryConfig = dict
|
|
31
|
+
MetricsMiddleware = dict
|
|
32
|
+
Middleware = dict
|
|
33
|
+
MongoDbConfig = dict
|
|
34
|
+
MqttConfig = dict
|
|
35
|
+
NatsConfig = dict
|
|
36
|
+
ObjectStoreConfig = dict
|
|
37
|
+
OtelMiddleware = dict
|
|
38
|
+
PackMiddleware = dict
|
|
39
|
+
PostgresCdcConfig = dict
|
|
40
|
+
RandomPanicMiddleware = dict
|
|
41
|
+
RedisStreamsConfig = dict
|
|
42
|
+
RequestForwardConfig = dict
|
|
43
|
+
ResponseConfig = dict
|
|
44
|
+
RetryMiddleware = dict
|
|
45
|
+
Route = dict
|
|
46
|
+
SequenceConfig = dict
|
|
47
|
+
SledConfig = dict
|
|
48
|
+
SqlxConfig = dict
|
|
49
|
+
StreamBufferConfig = dict
|
|
50
|
+
SwitchCase = dict
|
|
51
|
+
SwitchConfig = dict
|
|
52
|
+
TimeoutMiddleware = dict
|
|
53
|
+
TlsConfig = dict
|
|
54
|
+
TransformMiddleware = dict
|
|
55
|
+
UnpackMiddleware = dict
|
|
56
|
+
WeakJoinMiddleware = dict
|
|
57
|
+
WebSocketConfig = dict
|
|
58
|
+
ZeroMqConfig = dict
|
|
59
|
+
AggregateConsistency = str
|
|
60
|
+
AggregateEmit = str
|
|
61
|
+
CipherKind = str
|
|
62
|
+
Compression = str
|
|
63
|
+
DatePartitionStyle = str
|
|
64
|
+
DeliveryGuarantee = str
|
|
65
|
+
FaultMode = str
|
|
66
|
+
FileFormat = str
|
|
67
|
+
HttpServerProtocol = str
|
|
68
|
+
IdHash = str
|
|
69
|
+
MappingRule = str
|
|
70
|
+
MongoConsume = str
|
|
71
|
+
MongoDbFormat = str
|
|
72
|
+
MqttProtocol = str
|
|
73
|
+
NameBy = str
|
|
74
|
+
NatsDeliverPolicy = str
|
|
75
|
+
PackFormat = str
|
|
76
|
+
PostgresConsume = str
|
|
77
|
+
SpoolClaim = str
|
|
78
|
+
SpoolDone = str
|
|
79
|
+
SpoolFsync = str
|
|
80
|
+
StaticConfig = str
|
|
81
|
+
TransformErrorPolicy = str
|
|
82
|
+
WeakJoinAck = str
|
|
83
|
+
WeakJoinTimeout = str
|
|
84
|
+
WebSocketExecutionMode = str
|
|
85
|
+
ZeroMqBackend = str
|
|
86
|
+
ZeroMqFormat = str
|
|
87
|
+
ZeroMqSocketType = str
|
|
88
|
+
RouteConfig = Route
|
|
89
|
+
EndpointConfig = Endpoint
|
|
90
|
+
RoutesConfig = dict
|
|
91
|
+
ConfigDocument = dict
|
|
92
|
+
|
|
93
|
+
__all__ = [
|
|
94
|
+
"AggregateConsistency",
|
|
95
|
+
"AggregateEmit",
|
|
96
|
+
"AggregateEntry",
|
|
97
|
+
"AggregateMiddleware",
|
|
98
|
+
"AmqpConfig",
|
|
99
|
+
"AwsConfig",
|
|
100
|
+
"BufferMiddleware",
|
|
101
|
+
"CipherKind",
|
|
102
|
+
"ClickHouseConfig",
|
|
103
|
+
"Compression",
|
|
104
|
+
"CompressionMiddleware",
|
|
105
|
+
"ConfigDocument",
|
|
106
|
+
"CookieJarMiddleware",
|
|
107
|
+
"DatePartitionStyle",
|
|
108
|
+
"DeadLetterQueueMiddleware",
|
|
109
|
+
"DeduplicationMiddleware",
|
|
110
|
+
"DelayMiddleware",
|
|
111
|
+
"DeliveryGuarantee",
|
|
112
|
+
"DetailedMappingRule",
|
|
113
|
+
"DirSpoolConfig",
|
|
114
|
+
"EncryptionConfig",
|
|
115
|
+
"Endpoint",
|
|
116
|
+
"EndpointConfig",
|
|
117
|
+
"FaultMode",
|
|
118
|
+
"FileConfig",
|
|
119
|
+
"FileFormat",
|
|
120
|
+
"GrpcConfig",
|
|
121
|
+
"HttpConfig",
|
|
122
|
+
"HttpServerProtocol",
|
|
123
|
+
"IbmMqConfig",
|
|
124
|
+
"IbmTlsConfig",
|
|
125
|
+
"IdHash",
|
|
126
|
+
"KafkaConfig",
|
|
127
|
+
"LimiterMiddleware",
|
|
128
|
+
"LookupEntry",
|
|
129
|
+
"LookupMiddleware",
|
|
130
|
+
"MappingRule",
|
|
131
|
+
"MemoryConfig",
|
|
132
|
+
"MetricsMiddleware",
|
|
133
|
+
"Middleware",
|
|
134
|
+
"MongoConsume",
|
|
135
|
+
"MongoDbConfig",
|
|
136
|
+
"MongoDbFormat",
|
|
137
|
+
"MqttConfig",
|
|
138
|
+
"MqttProtocol",
|
|
139
|
+
"NameBy",
|
|
140
|
+
"NatsConfig",
|
|
141
|
+
"NatsDeliverPolicy",
|
|
142
|
+
"ObjectStoreConfig",
|
|
143
|
+
"OtelMiddleware",
|
|
144
|
+
"PackFormat",
|
|
145
|
+
"PackMiddleware",
|
|
146
|
+
"PostgresCdcConfig",
|
|
147
|
+
"PostgresConsume",
|
|
148
|
+
"RandomPanicMiddleware",
|
|
149
|
+
"RedisStreamsConfig",
|
|
150
|
+
"RequestForwardConfig",
|
|
151
|
+
"ResponseConfig",
|
|
152
|
+
"RetryMiddleware",
|
|
153
|
+
"Route",
|
|
154
|
+
"RouteConfig",
|
|
155
|
+
"RoutesConfig",
|
|
156
|
+
"SequenceConfig",
|
|
157
|
+
"SledConfig",
|
|
158
|
+
"SpoolClaim",
|
|
159
|
+
"SpoolDone",
|
|
160
|
+
"SpoolFsync",
|
|
161
|
+
"SqlxConfig",
|
|
162
|
+
"StaticConfig",
|
|
163
|
+
"StreamBufferConfig",
|
|
164
|
+
"SwitchCase",
|
|
165
|
+
"SwitchConfig",
|
|
166
|
+
"TimeoutMiddleware",
|
|
167
|
+
"TlsConfig",
|
|
168
|
+
"TransformErrorPolicy",
|
|
169
|
+
"TransformMiddleware",
|
|
170
|
+
"UnpackMiddleware",
|
|
171
|
+
"WeakJoinAck",
|
|
172
|
+
"WeakJoinMiddleware",
|
|
173
|
+
"WeakJoinTimeout",
|
|
174
|
+
"WebSocketConfig",
|
|
175
|
+
"WebSocketExecutionMode",
|
|
176
|
+
"ZeroMqBackend",
|
|
177
|
+
"ZeroMqConfig",
|
|
178
|
+
"ZeroMqFormat",
|
|
179
|
+
"ZeroMqSocketType",
|
|
180
|
+
]
|