jararaca 0.3.11a16__py3-none-any.whl → 0.4.0a19__py3-none-any.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.
- README.md +121 -0
- jararaca/__init__.py +189 -17
- jararaca/__main__.py +4 -0
- jararaca/broker_backend/__init__.py +4 -0
- jararaca/broker_backend/mapper.py +4 -0
- jararaca/broker_backend/redis_broker_backend.py +9 -3
- jararaca/cli.py +915 -51
- jararaca/common/__init__.py +3 -0
- jararaca/core/__init__.py +3 -0
- jararaca/core/providers.py +8 -0
- jararaca/core/uow.py +41 -7
- jararaca/di.py +4 -0
- jararaca/files/entity.py.mako +4 -0
- jararaca/helpers/__init__.py +3 -0
- jararaca/helpers/global_scheduler/__init__.py +3 -0
- jararaca/helpers/global_scheduler/config.py +21 -0
- jararaca/helpers/global_scheduler/controller.py +42 -0
- jararaca/helpers/global_scheduler/registry.py +32 -0
- jararaca/lifecycle.py +6 -2
- jararaca/messagebus/__init__.py +4 -0
- jararaca/messagebus/bus_message_controller.py +4 -0
- jararaca/messagebus/consumers/__init__.py +3 -0
- jararaca/messagebus/decorators.py +121 -61
- jararaca/messagebus/implicit_headers.py +49 -0
- jararaca/messagebus/interceptors/__init__.py +3 -0
- jararaca/messagebus/interceptors/aiopika_publisher_interceptor.py +62 -11
- jararaca/messagebus/interceptors/message_publisher_collector.py +62 -0
- jararaca/messagebus/interceptors/publisher_interceptor.py +29 -3
- jararaca/messagebus/message.py +4 -0
- jararaca/messagebus/publisher.py +6 -0
- jararaca/messagebus/worker.py +1002 -459
- jararaca/microservice.py +113 -2
- jararaca/observability/constants.py +7 -0
- jararaca/observability/decorators.py +170 -13
- jararaca/observability/fastapi_exception_handler.py +37 -0
- jararaca/observability/hooks.py +109 -0
- jararaca/observability/interceptor.py +4 -0
- jararaca/observability/providers/__init__.py +3 -0
- jararaca/observability/providers/otel.py +225 -16
- jararaca/persistence/base.py +39 -3
- jararaca/persistence/exports.py +4 -0
- jararaca/persistence/interceptors/__init__.py +3 -0
- jararaca/persistence/interceptors/aiosqa_interceptor.py +86 -73
- jararaca/persistence/interceptors/constants.py +5 -0
- jararaca/persistence/interceptors/decorators.py +50 -0
- jararaca/persistence/session.py +3 -0
- jararaca/persistence/sort_filter.py +4 -0
- jararaca/persistence/utilities.py +73 -20
- jararaca/presentation/__init__.py +3 -0
- jararaca/presentation/decorators.py +88 -86
- jararaca/presentation/exceptions.py +23 -0
- jararaca/presentation/hooks.py +4 -0
- jararaca/presentation/http_microservice.py +4 -0
- jararaca/presentation/server.py +97 -45
- jararaca/presentation/websocket/__init__.py +3 -0
- jararaca/presentation/websocket/base_types.py +4 -0
- jararaca/presentation/websocket/context.py +4 -0
- jararaca/presentation/websocket/decorators.py +8 -41
- jararaca/presentation/websocket/redis.py +280 -53
- jararaca/presentation/websocket/types.py +4 -0
- jararaca/presentation/websocket/websocket_interceptor.py +46 -19
- jararaca/reflect/__init__.py +3 -0
- jararaca/reflect/controller_inspect.py +16 -10
- jararaca/reflect/decorators.py +252 -0
- jararaca/reflect/helpers.py +18 -0
- jararaca/reflect/metadata.py +34 -25
- jararaca/rpc/__init__.py +3 -0
- jararaca/rpc/http/__init__.py +101 -0
- jararaca/rpc/http/backends/__init__.py +14 -0
- jararaca/rpc/http/backends/httpx.py +43 -9
- jararaca/rpc/http/backends/otel.py +4 -0
- jararaca/rpc/http/decorators.py +380 -115
- jararaca/rpc/http/httpx.py +3 -0
- jararaca/scheduler/__init__.py +3 -0
- jararaca/scheduler/beat_worker.py +521 -105
- jararaca/scheduler/decorators.py +15 -22
- jararaca/scheduler/types.py +4 -0
- jararaca/tools/app_config/__init__.py +3 -0
- jararaca/tools/app_config/decorators.py +7 -19
- jararaca/tools/app_config/interceptor.py +6 -2
- jararaca/tools/typescript/__init__.py +3 -0
- jararaca/tools/typescript/decorators.py +120 -0
- jararaca/tools/typescript/interface_parser.py +1077 -174
- jararaca/utils/__init__.py +3 -0
- jararaca/utils/env_parse_utils.py +133 -0
- jararaca/utils/rabbitmq_utils.py +112 -39
- jararaca/utils/retry.py +19 -14
- jararaca-0.4.0a19.dist-info/LICENSE +674 -0
- jararaca-0.4.0a19.dist-info/LICENSES/GPL-3.0-or-later.txt +232 -0
- {jararaca-0.3.11a16.dist-info → jararaca-0.4.0a19.dist-info}/METADATA +12 -7
- jararaca-0.4.0a19.dist-info/RECORD +96 -0
- {jararaca-0.3.11a16.dist-info → jararaca-0.4.0a19.dist-info}/WHEEL +1 -1
- pyproject.toml +132 -0
- jararaca-0.3.11a16.dist-info/RECORD +0 -74
- /jararaca-0.3.11a16.dist-info/LICENSE → /LICENSE +0 -0
- {jararaca-0.3.11a16.dist-info → jararaca-0.4.0a19.dist-info}/entry_points.txt +0 -0
README.md
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
<img src="https://raw.githubusercontent.com/LuscasLeo/jararaca/main/docs/assets/_f04774c9-7e05-4da4-8b17-8be23f6a1475.jpeg" alt="Jararaca Logo" width="250" float="right">
|
|
2
|
+
|
|
3
|
+
# Jararaca Microservice Framework
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Jararaca is an async-first microservice framework designed to simplify the development of distributed systems. It provides a comprehensive set of tools for building robust, scalable, and maintainable microservices with a focus on developer experience and type safety.
|
|
8
|
+
|
|
9
|
+
## Key Features
|
|
10
|
+
|
|
11
|
+
### REST API Development
|
|
12
|
+
- Easy-to-use interfaces for building REST APIs
|
|
13
|
+
- Automatic request/response validation
|
|
14
|
+
- Type-safe endpoints with FastAPI integration
|
|
15
|
+
- Automatic OpenAPI documentation generation
|
|
16
|
+
|
|
17
|
+
### Message Bus Integration
|
|
18
|
+
- Topic-based message bus for event-driven architecture
|
|
19
|
+
- Support for both worker and publisher patterns
|
|
20
|
+
- Built-in message serialization and deserialization
|
|
21
|
+
- Easy integration with AIO Pika for RabbitMQ
|
|
22
|
+
|
|
23
|
+
### Distributed WebSocket
|
|
24
|
+
- Room-based WebSocket communication
|
|
25
|
+
- Distributed broadcasting across multiple backend instances
|
|
26
|
+
- Automatic message synchronization between instances
|
|
27
|
+
- Built-in connection management and room handling
|
|
28
|
+
|
|
29
|
+
### Task Scheduling
|
|
30
|
+
- Cron-based task scheduling
|
|
31
|
+
- Support for overlapping and non-overlapping tasks
|
|
32
|
+
- Distributed task execution
|
|
33
|
+
- Easy integration with message bus for task distribution
|
|
34
|
+
|
|
35
|
+
### TypeScript Integration
|
|
36
|
+
- Automatic TypeScript interface generation
|
|
37
|
+
- Command-line tool for generating TypeScript types
|
|
38
|
+
- Support for REST endpoints, WebSocket events, and message bus payloads
|
|
39
|
+
- Type-safe frontend-backend communication
|
|
40
|
+
- **`@ExposeType` decorator** - Explicitly expose types for TypeScript generation without needing them in endpoints
|
|
41
|
+
|
|
42
|
+
### Hexagonal Architecture
|
|
43
|
+
- Clear separation of concerns
|
|
44
|
+
- Business logic isolation from infrastructure
|
|
45
|
+
- Easy testing and maintainability
|
|
46
|
+
- Dependency injection for flexible component management
|
|
47
|
+
|
|
48
|
+
### Observability
|
|
49
|
+
- Built-in OpenTelemetry integration
|
|
50
|
+
- Distributed tracing support
|
|
51
|
+
- Logging and metrics collection
|
|
52
|
+
- Performance monitoring capabilities
|
|
53
|
+
|
|
54
|
+
## Quick Start
|
|
55
|
+
|
|
56
|
+
### Installation
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
pip install jararaca
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Basic Usage
|
|
63
|
+
|
|
64
|
+
```python
|
|
65
|
+
from jararaca import Microservice, create_http_server
|
|
66
|
+
from jararaca.presentation.http_microservice import HttpMicroservice
|
|
67
|
+
|
|
68
|
+
# Define your microservice
|
|
69
|
+
app = Microservice(
|
|
70
|
+
providers=[
|
|
71
|
+
# Add your providers here
|
|
72
|
+
],
|
|
73
|
+
controllers=[
|
|
74
|
+
# Add your controllers here
|
|
75
|
+
],
|
|
76
|
+
interceptors=[
|
|
77
|
+
# Add your interceptors here
|
|
78
|
+
],
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
# Create HTTP server
|
|
82
|
+
http_app = HttpMicroservice(app)
|
|
83
|
+
web_app = create_http_server(app)
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Running the Service
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# Run as HTTP server
|
|
90
|
+
jararaca server app:http_app
|
|
91
|
+
|
|
92
|
+
# Run as message bus worker
|
|
93
|
+
jararaca worker app:app
|
|
94
|
+
|
|
95
|
+
# Run as scheduler
|
|
96
|
+
jararaca scheduler app:app
|
|
97
|
+
|
|
98
|
+
# Generate TypeScript interfaces
|
|
99
|
+
jararaca gen-tsi app.main:app app.ts
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Documentation
|
|
103
|
+
|
|
104
|
+
For detailed documentation, please visit our [documentation site](https://luscasleo.github.io/jararaca/).
|
|
105
|
+
|
|
106
|
+
## Examples
|
|
107
|
+
|
|
108
|
+
Check out the [examples directory](examples/) for complete working examples of:
|
|
109
|
+
- REST API implementation
|
|
110
|
+
- WebSocket usage
|
|
111
|
+
- Message bus integration
|
|
112
|
+
- Task scheduling
|
|
113
|
+
- TypeScript interface generation
|
|
114
|
+
|
|
115
|
+
## Contributing
|
|
116
|
+
|
|
117
|
+
Contributions are welcome! Please read our [contributing guidelines](.github/CONTRIBUTING.md) for details on our code of conduct and the process for submitting pull requests.
|
|
118
|
+
|
|
119
|
+
## License
|
|
120
|
+
|
|
121
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
jararaca/__init__.py
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2025 Lucas S
|
|
2
|
+
#
|
|
3
|
+
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
4
|
+
|
|
1
5
|
from importlib import import_module
|
|
2
6
|
from typing import TYPE_CHECKING
|
|
3
7
|
|
|
@@ -11,7 +15,28 @@ if TYPE_CHECKING:
|
|
|
11
15
|
retry_later,
|
|
12
16
|
use_bus_message_controller,
|
|
13
17
|
)
|
|
14
|
-
from jararaca.microservice import
|
|
18
|
+
from jararaca.microservice import (
|
|
19
|
+
AppContext,
|
|
20
|
+
AppInterceptor,
|
|
21
|
+
AppTransactionContext,
|
|
22
|
+
use_app_type,
|
|
23
|
+
)
|
|
24
|
+
from jararaca.observability.decorators import TracedClass, TracedFunc, traced_class
|
|
25
|
+
from jararaca.observability.fastapi_exception_handler import (
|
|
26
|
+
setup_fastapi_exception_handler,
|
|
27
|
+
)
|
|
28
|
+
from jararaca.observability.hooks import (
|
|
29
|
+
add_event,
|
|
30
|
+
add_span_link,
|
|
31
|
+
get_current_span,
|
|
32
|
+
get_current_span_context,
|
|
33
|
+
get_tracing_provider,
|
|
34
|
+
record_exception,
|
|
35
|
+
set_span_attribute,
|
|
36
|
+
set_span_status,
|
|
37
|
+
spawn_trace,
|
|
38
|
+
start_span,
|
|
39
|
+
)
|
|
15
40
|
from jararaca.observability.interceptor import ObservabilityInterceptor
|
|
16
41
|
from jararaca.observability.providers.otel import OtelObservabilityProvider
|
|
17
42
|
from jararaca.persistence.sort_filter import (
|
|
@@ -22,6 +47,7 @@ if TYPE_CHECKING:
|
|
|
22
47
|
SortModel,
|
|
23
48
|
SortRuleApplier,
|
|
24
49
|
)
|
|
50
|
+
from jararaca.presentation.exceptions import PresentationException
|
|
25
51
|
from jararaca.presentation.hooks import (
|
|
26
52
|
raises_200_on,
|
|
27
53
|
raises_400_on,
|
|
@@ -38,34 +64,58 @@ if TYPE_CHECKING:
|
|
|
38
64
|
)
|
|
39
65
|
from jararaca.reflect.metadata import (
|
|
40
66
|
SetMetadata,
|
|
67
|
+
TransactionMetadata,
|
|
41
68
|
get_all_metadata,
|
|
42
69
|
get_metadata,
|
|
43
70
|
get_metadata_value,
|
|
44
|
-
|
|
71
|
+
start_providing_metadata,
|
|
72
|
+
start_transaction_metadata_context,
|
|
45
73
|
)
|
|
46
74
|
from jararaca.rpc.http.backends.httpx import HTTPXHttpRPCAsyncBackend
|
|
47
75
|
from jararaca.rpc.http.backends.otel import TracedRequestMiddleware
|
|
48
|
-
from jararaca.rpc.http.decorators import
|
|
76
|
+
from jararaca.rpc.http.decorators import ( # New request parameter decorators; Configuration decorators; Authentication classes; Middleware classes; Configuration classes; Exception classes
|
|
77
|
+
ApiKeyAuth,
|
|
78
|
+
AuthenticationMiddleware,
|
|
79
|
+
BasicAuth,
|
|
80
|
+
BearerTokenAuth,
|
|
81
|
+
Body,
|
|
82
|
+
CacheMiddleware,
|
|
83
|
+
ContentType,
|
|
84
|
+
)
|
|
49
85
|
from jararaca.rpc.http.decorators import Delete as HttpDelete
|
|
86
|
+
from jararaca.rpc.http.decorators import ( # New request parameter decorators; Configuration decorators; Authentication classes; Middleware classes; Configuration classes; Exception classes
|
|
87
|
+
File,
|
|
88
|
+
FormData,
|
|
89
|
+
)
|
|
50
90
|
from jararaca.rpc.http.decorators import Get as HttpGet
|
|
51
|
-
from jararaca.rpc.http.decorators import (
|
|
91
|
+
from jararaca.rpc.http.decorators import ( # New request parameter decorators; Configuration decorators; Authentication classes; Middleware classes; Configuration classes; Exception classes
|
|
52
92
|
GlobalHttpErrorHandler,
|
|
53
93
|
Header,
|
|
54
94
|
HttpMapping,
|
|
55
95
|
HttpRpcClientBuilder,
|
|
56
96
|
)
|
|
57
97
|
from jararaca.rpc.http.decorators import Patch as HttpPatch
|
|
58
|
-
from jararaca.rpc.http.decorators import
|
|
98
|
+
from jararaca.rpc.http.decorators import ( # New request parameter decorators; Configuration decorators; Authentication classes; Middleware classes; Configuration classes; Exception classes
|
|
99
|
+
PathParam,
|
|
100
|
+
)
|
|
59
101
|
from jararaca.rpc.http.decorators import Post as HttpPost
|
|
60
102
|
from jararaca.rpc.http.decorators import Put as HttpPut
|
|
61
|
-
from jararaca.rpc.http.decorators import (
|
|
103
|
+
from jararaca.rpc.http.decorators import ( # New request parameter decorators; Configuration decorators; Authentication classes; Middleware classes; Configuration classes; Exception classes
|
|
62
104
|
Query,
|
|
63
105
|
RequestAttribute,
|
|
106
|
+
RequestHook,
|
|
107
|
+
ResponseHook,
|
|
108
|
+
ResponseMiddleware,
|
|
64
109
|
RestClient,
|
|
110
|
+
Retry,
|
|
65
111
|
RouteHttpErrorHandler,
|
|
66
112
|
RPCRequestNetworkError,
|
|
113
|
+
RPCRetryPolicy,
|
|
67
114
|
RPCUnhandleError,
|
|
115
|
+
Timeout,
|
|
116
|
+
TimeoutException,
|
|
68
117
|
)
|
|
118
|
+
from jararaca.utils.retry import RetryPolicy
|
|
69
119
|
|
|
70
120
|
from .core.providers import ProviderSpec, Token
|
|
71
121
|
from .di import Container
|
|
@@ -81,6 +131,9 @@ if TYPE_CHECKING:
|
|
|
81
131
|
from .messagebus.publisher import use_publisher
|
|
82
132
|
from .microservice import (
|
|
83
133
|
Microservice,
|
|
134
|
+
is_shutting_down,
|
|
135
|
+
request_shutdown,
|
|
136
|
+
shutdown_race,
|
|
84
137
|
use_app_context,
|
|
85
138
|
use_app_transaction_context,
|
|
86
139
|
use_app_tx_ctx_data,
|
|
@@ -96,6 +149,11 @@ if TYPE_CHECKING:
|
|
|
96
149
|
use_session,
|
|
97
150
|
use_transaction,
|
|
98
151
|
)
|
|
152
|
+
from .persistence.interceptors.decorators import (
|
|
153
|
+
set_use_persistence_session,
|
|
154
|
+
skip_persistence_session,
|
|
155
|
+
uses_persistence_session,
|
|
156
|
+
)
|
|
99
157
|
from .persistence.utilities import (
|
|
100
158
|
CriteriaBasedAttributeQueryInjector,
|
|
101
159
|
CRUDOperations,
|
|
@@ -120,6 +178,7 @@ if TYPE_CHECKING:
|
|
|
120
178
|
RestController,
|
|
121
179
|
UseDependency,
|
|
122
180
|
UseMiddleware,
|
|
181
|
+
compose_route_decorators,
|
|
123
182
|
)
|
|
124
183
|
from .presentation.http_microservice import HttpMicroservice, HttpMiddleware
|
|
125
184
|
from .presentation.server import create_http_server
|
|
@@ -137,14 +196,23 @@ if TYPE_CHECKING:
|
|
|
137
196
|
from .presentation.websocket.websocket_interceptor import WebSocketInterceptor
|
|
138
197
|
from .scheduler.decorators import ScheduledAction
|
|
139
198
|
from .tools.app_config.interceptor import AppConfigurationInterceptor
|
|
199
|
+
from .tools.typescript.decorators import (
|
|
200
|
+
ExposeType,
|
|
201
|
+
MutationEndpoint,
|
|
202
|
+
QueryEndpoint,
|
|
203
|
+
SplitInputOutput,
|
|
204
|
+
)
|
|
140
205
|
|
|
141
206
|
__all__ = [
|
|
142
207
|
"SetMetadata",
|
|
143
|
-
"
|
|
208
|
+
"start_transaction_metadata_context",
|
|
209
|
+
"start_providing_metadata",
|
|
210
|
+
"TransactionMetadata",
|
|
144
211
|
"get_metadata",
|
|
145
212
|
"get_all_metadata",
|
|
146
213
|
"get_metadata_value",
|
|
147
214
|
"RedisMessageBrokerBackend",
|
|
215
|
+
"RetryPolicy",
|
|
148
216
|
"FilterRuleApplier",
|
|
149
217
|
"SortRuleApplier",
|
|
150
218
|
"use_bus_message_controller",
|
|
@@ -162,6 +230,7 @@ if TYPE_CHECKING:
|
|
|
162
230
|
"RegisterWebSocketMessage",
|
|
163
231
|
"TracedRequestMiddleware",
|
|
164
232
|
"raises_http_exception_on",
|
|
233
|
+
"PresentationException",
|
|
165
234
|
"raises_200_on",
|
|
166
235
|
"raises_422_on",
|
|
167
236
|
"raises_404_on",
|
|
@@ -183,9 +252,30 @@ if TYPE_CHECKING:
|
|
|
183
252
|
"HttpPut",
|
|
184
253
|
"HttpDelete",
|
|
185
254
|
"ObservabilityInterceptor",
|
|
255
|
+
"TracedFunc",
|
|
256
|
+
"TracedClass",
|
|
257
|
+
"traced_class",
|
|
258
|
+
"start_span",
|
|
259
|
+
"add_span_link",
|
|
260
|
+
"get_current_span",
|
|
261
|
+
"get_current_span_context",
|
|
262
|
+
"spawn_trace",
|
|
263
|
+
"set_span_attribute",
|
|
264
|
+
"add_event",
|
|
265
|
+
"setup_fastapi_exception_handler",
|
|
266
|
+
"set_span_status",
|
|
267
|
+
"record_exception",
|
|
268
|
+
"get_tracing_provider",
|
|
186
269
|
"QueryInjector",
|
|
187
270
|
"HttpMicroservice",
|
|
188
271
|
"use_current_container",
|
|
272
|
+
"use_app_context",
|
|
273
|
+
"use_app_transaction_context",
|
|
274
|
+
"use_app_tx_ctx_data",
|
|
275
|
+
"is_shutting_down",
|
|
276
|
+
"shutdown_race",
|
|
277
|
+
"request_shutdown",
|
|
278
|
+
"Microservice",
|
|
189
279
|
"T_BASEMODEL",
|
|
190
280
|
"DatedEntity",
|
|
191
281
|
"BaseEntity",
|
|
@@ -208,7 +298,6 @@ if TYPE_CHECKING:
|
|
|
208
298
|
"MessageBusController",
|
|
209
299
|
"MessageHandler",
|
|
210
300
|
"ScheduledAction",
|
|
211
|
-
"Microservice",
|
|
212
301
|
"ProviderSpec",
|
|
213
302
|
"Token",
|
|
214
303
|
"AIOSqlAlchemySessionInterceptor",
|
|
@@ -219,7 +308,9 @@ if TYPE_CHECKING:
|
|
|
219
308
|
"use_session",
|
|
220
309
|
"use_transaction",
|
|
221
310
|
"providing_session",
|
|
222
|
-
"
|
|
311
|
+
"uses_persistence_session",
|
|
312
|
+
"skip_persistence_session",
|
|
313
|
+
"set_use_persistence_session",
|
|
223
314
|
"providing_transaction",
|
|
224
315
|
"providing_new_session",
|
|
225
316
|
"Post",
|
|
@@ -233,8 +324,13 @@ if TYPE_CHECKING:
|
|
|
233
324
|
"MessageBusPublisherInterceptor",
|
|
234
325
|
"RedisWebSocketConnectionBackend",
|
|
235
326
|
"AppConfigurationInterceptor",
|
|
327
|
+
"ExposeType",
|
|
328
|
+
"QueryEndpoint",
|
|
329
|
+
"MutationEndpoint",
|
|
330
|
+
"SplitInputOutput",
|
|
236
331
|
"UseMiddleware",
|
|
237
332
|
"UseDependency",
|
|
333
|
+
"compose_route_decorators",
|
|
238
334
|
"GlobalHttpErrorHandler",
|
|
239
335
|
"RouteHttpErrorHandler",
|
|
240
336
|
"WebSocketMessage",
|
|
@@ -242,10 +338,29 @@ if TYPE_CHECKING:
|
|
|
242
338
|
"provide_ws_manager",
|
|
243
339
|
"HttpRpcClientBuilder",
|
|
244
340
|
"HTTPXHttpRPCAsyncBackend",
|
|
245
|
-
|
|
246
|
-
"
|
|
247
|
-
"
|
|
341
|
+
# New request parameter decorators
|
|
342
|
+
"FormData",
|
|
343
|
+
"File",
|
|
344
|
+
# Configuration decorators
|
|
345
|
+
"Timeout",
|
|
346
|
+
"Retry",
|
|
347
|
+
"ContentType",
|
|
348
|
+
# Authentication classes
|
|
349
|
+
"BearerTokenAuth",
|
|
350
|
+
"BasicAuth",
|
|
351
|
+
"ApiKeyAuth",
|
|
352
|
+
# Middleware classes
|
|
353
|
+
"CacheMiddleware",
|
|
354
|
+
"AuthenticationMiddleware",
|
|
355
|
+
"ResponseMiddleware",
|
|
356
|
+
"RequestHook",
|
|
357
|
+
"ResponseHook",
|
|
358
|
+
# Configuration classes
|
|
359
|
+
"RPCRetryPolicy",
|
|
360
|
+
# Exception classes
|
|
361
|
+
"TimeoutException",
|
|
248
362
|
"AppTransactionContext",
|
|
363
|
+
"use_app_type",
|
|
249
364
|
"AppContext",
|
|
250
365
|
"ControllerMemberReflect",
|
|
251
366
|
"ControllerReflect",
|
|
@@ -257,10 +372,13 @@ __SPEC_PARENT__: str = __spec__.parent # type: ignore
|
|
|
257
372
|
# A mapping of {<member name>: (package, <module name>)} defining dynamic imports
|
|
258
373
|
_dynamic_imports: "dict[str, tuple[str, str, str | None]]" = {
|
|
259
374
|
"SetMetadata": (__SPEC_PARENT__, "reflect.metadata", None),
|
|
260
|
-
"
|
|
375
|
+
"TransactionMetadata": (__SPEC_PARENT__, "reflect.metadata", None),
|
|
376
|
+
"start_transaction_metadata_context": (__SPEC_PARENT__, "reflect.metadata", None),
|
|
377
|
+
"start_providing_metadata": (__SPEC_PARENT__, "reflect.metadata", None),
|
|
261
378
|
"get_metadata": (__SPEC_PARENT__, "reflect.metadata", None),
|
|
262
379
|
"get_all_metadata": (__SPEC_PARENT__, "reflect.metadata", None),
|
|
263
380
|
"get_metadata_value": (__SPEC_PARENT__, "reflect.metadata", None),
|
|
381
|
+
"RetryPolicy": (__SPEC_PARENT__, "utils.retry", None),
|
|
264
382
|
"RedisMessageBrokerBackend": (
|
|
265
383
|
__SPEC_PARENT__,
|
|
266
384
|
"broker_backend.redis_broker_backend",
|
|
@@ -301,6 +419,7 @@ _dynamic_imports: "dict[str, tuple[str, str, str | None]]" = {
|
|
|
301
419
|
),
|
|
302
420
|
"TracedRequestMiddleware": (__SPEC_PARENT__, "rpc.http.backends.otel", None),
|
|
303
421
|
"raises_http_exception_on": (__SPEC_PARENT__, "presentation.hooks", None),
|
|
422
|
+
"PresentationException": (__SPEC_PARENT__, "presentation.exceptions", None),
|
|
304
423
|
"raises_200_on": (__SPEC_PARENT__, "presentation.hooks", None),
|
|
305
424
|
"raises_400_on": (__SPEC_PARENT__, "presentation.hooks", None),
|
|
306
425
|
"raises_401_on": (__SPEC_PARENT__, "presentation.hooks", None),
|
|
@@ -322,6 +441,24 @@ _dynamic_imports: "dict[str, tuple[str, str, str | None]]" = {
|
|
|
322
441
|
"HttpPut": (__SPEC_PARENT__, "rpc.http.decorators", "Put"),
|
|
323
442
|
"HttpDelete": (__SPEC_PARENT__, "rpc.http.decorators", "Delete"),
|
|
324
443
|
"ObservabilityInterceptor": (__SPEC_PARENT__, "observability.interceptor", None),
|
|
444
|
+
"TracedFunc": (__SPEC_PARENT__, "observability.decorators", None),
|
|
445
|
+
"TracedClass": (__SPEC_PARENT__, "observability.decorators", None),
|
|
446
|
+
"traced_class": (__SPEC_PARENT__, "observability.decorators", None),
|
|
447
|
+
"spawn_trace": (__SPEC_PARENT__, "observability.hooks", None),
|
|
448
|
+
"setup_fastapi_exception_handler": (
|
|
449
|
+
__SPEC_PARENT__,
|
|
450
|
+
"observability.fastapi_exception_handler",
|
|
451
|
+
None,
|
|
452
|
+
),
|
|
453
|
+
"set_span_attribute": (__SPEC_PARENT__, "observability.hooks", None),
|
|
454
|
+
"start_span": (__SPEC_PARENT__, "observability.hooks", None),
|
|
455
|
+
"add_span_link": (__SPEC_PARENT__, "observability.hooks", None),
|
|
456
|
+
"get_current_span": (__SPEC_PARENT__, "observability.hooks", None),
|
|
457
|
+
"get_current_span_context": (__SPEC_PARENT__, "observability.hooks", None),
|
|
458
|
+
"add_event": (__SPEC_PARENT__, "observability.hooks", None),
|
|
459
|
+
"set_span_status": (__SPEC_PARENT__, "observability.hooks", None),
|
|
460
|
+
"record_exception": (__SPEC_PARENT__, "observability.hooks", None),
|
|
461
|
+
"get_tracing_provider": (__SPEC_PARENT__, "observability.hooks", None),
|
|
325
462
|
"QueryInjector": (__SPEC_PARENT__, "persistence.utilities", None),
|
|
326
463
|
"HttpMicroservice": (__SPEC_PARENT__, "presentation.http_microservice", None),
|
|
327
464
|
"use_current_container": (__SPEC_PARENT__, "microservice", None),
|
|
@@ -386,19 +523,29 @@ _dynamic_imports: "dict[str, tuple[str, str, str | None]]" = {
|
|
|
386
523
|
"persistence.interceptors.aiosqa_interceptor",
|
|
387
524
|
None,
|
|
388
525
|
),
|
|
389
|
-
"
|
|
526
|
+
"providing_new_session": (
|
|
390
527
|
__SPEC_PARENT__,
|
|
391
528
|
"persistence.interceptors.aiosqa_interceptor",
|
|
392
529
|
None,
|
|
393
530
|
),
|
|
394
|
-
"
|
|
531
|
+
"providing_transaction": (
|
|
395
532
|
__SPEC_PARENT__,
|
|
396
533
|
"persistence.interceptors.aiosqa_interceptor",
|
|
397
534
|
None,
|
|
398
535
|
),
|
|
399
|
-
"
|
|
536
|
+
"uses_persistence_session": (
|
|
400
537
|
__SPEC_PARENT__,
|
|
401
|
-
"persistence.interceptors.
|
|
538
|
+
"persistence.interceptors.decorators",
|
|
539
|
+
None,
|
|
540
|
+
),
|
|
541
|
+
"skip_persistence_session": (
|
|
542
|
+
__SPEC_PARENT__,
|
|
543
|
+
"persistence.interceptors.decorators",
|
|
544
|
+
None,
|
|
545
|
+
),
|
|
546
|
+
"set_use_persistence_session": (
|
|
547
|
+
__SPEC_PARENT__,
|
|
548
|
+
"persistence.interceptors.decorators",
|
|
402
549
|
None,
|
|
403
550
|
),
|
|
404
551
|
"Post": (__SPEC_PARENT__, "presentation.decorators", None),
|
|
@@ -427,8 +574,13 @@ _dynamic_imports: "dict[str, tuple[str, str, str | None]]" = {
|
|
|
427
574
|
"tools.app_config.interceptor",
|
|
428
575
|
None,
|
|
429
576
|
),
|
|
577
|
+
"ExposeType": (__SPEC_PARENT__, "tools.typescript.decorators", None),
|
|
578
|
+
"QueryEndpoint": (__SPEC_PARENT__, "tools.typescript.decorators", None),
|
|
579
|
+
"MutationEndpoint": (__SPEC_PARENT__, "tools.typescript.decorators", None),
|
|
580
|
+
"SplitInputOutput": (__SPEC_PARENT__, "tools.typescript.decorators", None),
|
|
430
581
|
"UseMiddleware": (__SPEC_PARENT__, "presentation.decorators", None),
|
|
431
582
|
"UseDependency": (__SPEC_PARENT__, "presentation.decorators", None),
|
|
583
|
+
"compose_route_decorators": (__SPEC_PARENT__, "presentation.decorators", None),
|
|
432
584
|
"GlobalHttpErrorHandler": (__SPEC_PARENT__, "rpc.http.decorators", None),
|
|
433
585
|
"RouteHttpErrorHandler": (__SPEC_PARENT__, "rpc.http.decorators", None),
|
|
434
586
|
"WebSocketMessage": (__SPEC_PARENT__, "presentation.websocket.types", None),
|
|
@@ -440,12 +592,32 @@ _dynamic_imports: "dict[str, tuple[str, str, str | None]]" = {
|
|
|
440
592
|
"provide_ws_manager": (__SPEC_PARENT__, "presentation.websocket.context", None),
|
|
441
593
|
"HttpRpcClientBuilder": (__SPEC_PARENT__, "rpc.http.decorators", None),
|
|
442
594
|
"HTTPXHttpRPCAsyncBackend": (__SPEC_PARENT__, "rpc.http.backends.httpx", None),
|
|
595
|
+
# New HTTP RPC classes
|
|
596
|
+
"FormData": (__SPEC_PARENT__, "rpc.http.decorators", None),
|
|
597
|
+
"File": (__SPEC_PARENT__, "rpc.http.decorators", None),
|
|
598
|
+
"Timeout": (__SPEC_PARENT__, "rpc.http.decorators", None),
|
|
599
|
+
"Retry": (__SPEC_PARENT__, "rpc.http.decorators", None),
|
|
600
|
+
"ContentType": (__SPEC_PARENT__, "rpc.http.decorators", None),
|
|
601
|
+
"BearerTokenAuth": (__SPEC_PARENT__, "rpc.http.decorators", None),
|
|
602
|
+
"BasicAuth": (__SPEC_PARENT__, "rpc.http.decorators", None),
|
|
603
|
+
"ApiKeyAuth": (__SPEC_PARENT__, "rpc.http.decorators", None),
|
|
604
|
+
"CacheMiddleware": (__SPEC_PARENT__, "rpc.http.decorators", None),
|
|
605
|
+
"AuthenticationMiddleware": (__SPEC_PARENT__, "rpc.http.decorators", None),
|
|
606
|
+
"ResponseMiddleware": (__SPEC_PARENT__, "rpc.http.decorators", None),
|
|
607
|
+
"RequestHook": (__SPEC_PARENT__, "rpc.http.decorators", None),
|
|
608
|
+
"ResponseHook": (__SPEC_PARENT__, "rpc.http.decorators", None),
|
|
609
|
+
"RPCRetryPolicy": (__SPEC_PARENT__, "rpc.http.decorators", None),
|
|
610
|
+
"TimeoutException": (__SPEC_PARENT__, "rpc.http.decorators", None),
|
|
443
611
|
"use_app_context": (__SPEC_PARENT__, "microservice", None),
|
|
444
612
|
"use_app_transaction_context": (__SPEC_PARENT__, "microservice", None),
|
|
445
613
|
"use_app_tx_ctx_data": (__SPEC_PARENT__, "microservice", None),
|
|
614
|
+
"is_shutting_down": (__SPEC_PARENT__, "microservice", None),
|
|
615
|
+
"shutdown_race": (__SPEC_PARENT__, "microservice", None),
|
|
616
|
+
"request_shutdown": (__SPEC_PARENT__, "microservice", None),
|
|
446
617
|
"AppContext": (__SPEC_PARENT__, "microservice", None),
|
|
447
618
|
"AppInterceptor": (__SPEC_PARENT__, "microservice", None),
|
|
448
619
|
"AppTransactionContext": (__SPEC_PARENT__, "microservice", None),
|
|
620
|
+
"use_app_type": (__SPEC_PARENT__, "microservice", None),
|
|
449
621
|
"ControllerMemberReflect": (__SPEC_PARENT__, "reflect.controller_inspect", None),
|
|
450
622
|
"ControllerReflect": (__SPEC_PARENT__, "reflect.controller_inspect", None),
|
|
451
623
|
}
|
jararaca/__main__.py
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2025 Lucas S
|
|
2
|
+
#
|
|
3
|
+
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
4
|
+
|
|
1
5
|
import logging
|
|
2
6
|
import time
|
|
3
7
|
from contextlib import asynccontextmanager
|
|
@@ -147,9 +151,11 @@ class RedisMessageBrokerBackend(MessageBrokerBackend):
|
|
|
147
151
|
)
|
|
148
152
|
delayed_messages.append(delayed_message)
|
|
149
153
|
except Exception:
|
|
150
|
-
logger.
|
|
151
|
-
|
|
152
|
-
|
|
154
|
+
if logger.isEnabledFor(logging.ERROR):
|
|
155
|
+
logger.error(
|
|
156
|
+
"Error parsing delayed message: %s",
|
|
157
|
+
task_bytes_data.decode(),
|
|
158
|
+
)
|
|
153
159
|
continue
|
|
154
160
|
|
|
155
161
|
return delayed_messages
|