jararaca 0.3.11a16__py3-none-any.whl → 0.4.0a5__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 +184 -12
- 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 +272 -47
- jararaca/common/__init__.py +3 -0
- jararaca/core/__init__.py +3 -0
- jararaca/core/providers.py +4 -0
- jararaca/core/uow.py +41 -7
- jararaca/di.py +4 -0
- jararaca/files/entity.py.mako +4 -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 +33 -67
- jararaca/messagebus/implicit_headers.py +49 -0
- jararaca/messagebus/interceptors/__init__.py +3 -0
- jararaca/messagebus/interceptors/aiopika_publisher_interceptor.py +13 -4
- jararaca/messagebus/interceptors/publisher_interceptor.py +4 -0
- jararaca/messagebus/message.py +4 -0
- jararaca/messagebus/publisher.py +6 -0
- jararaca/messagebus/worker.py +850 -383
- jararaca/microservice.py +110 -1
- 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 +202 -11
- jararaca/persistence/base.py +38 -2
- 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 +50 -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 +238 -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 +378 -113
- 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 +1074 -173
- jararaca/utils/__init__.py +3 -0
- jararaca/utils/rabbitmq_utils.py +65 -39
- jararaca/utils/retry.py +10 -3
- jararaca-0.4.0a5.dist-info/LICENSE +674 -0
- jararaca-0.4.0a5.dist-info/LICENSES/GPL-3.0-or-later.txt +232 -0
- {jararaca-0.3.11a16.dist-info → jararaca-0.4.0a5.dist-info}/METADATA +11 -7
- jararaca-0.4.0a5.dist-info/RECORD +88 -0
- {jararaca-0.3.11a16.dist-info → jararaca-0.4.0a5.dist-info}/WHEEL +1 -1
- pyproject.toml +131 -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.0a5.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,33 +64,56 @@ 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,
|
|
111
|
+
RetryConfig,
|
|
65
112
|
RouteHttpErrorHandler,
|
|
66
113
|
RPCRequestNetworkError,
|
|
67
114
|
RPCUnhandleError,
|
|
115
|
+
Timeout,
|
|
116
|
+
TimeoutException,
|
|
68
117
|
)
|
|
69
118
|
|
|
70
119
|
from .core.providers import ProviderSpec, Token
|
|
@@ -81,6 +130,8 @@ if TYPE_CHECKING:
|
|
|
81
130
|
from .messagebus.publisher import use_publisher
|
|
82
131
|
from .microservice import (
|
|
83
132
|
Microservice,
|
|
133
|
+
is_shutting_down,
|
|
134
|
+
request_shutdown,
|
|
84
135
|
use_app_context,
|
|
85
136
|
use_app_transaction_context,
|
|
86
137
|
use_app_tx_ctx_data,
|
|
@@ -96,6 +147,11 @@ if TYPE_CHECKING:
|
|
|
96
147
|
use_session,
|
|
97
148
|
use_transaction,
|
|
98
149
|
)
|
|
150
|
+
from .persistence.interceptors.decorators import (
|
|
151
|
+
set_use_persistence_session,
|
|
152
|
+
skip_persistence_session,
|
|
153
|
+
uses_persistence_session,
|
|
154
|
+
)
|
|
99
155
|
from .persistence.utilities import (
|
|
100
156
|
CriteriaBasedAttributeQueryInjector,
|
|
101
157
|
CRUDOperations,
|
|
@@ -120,6 +176,7 @@ if TYPE_CHECKING:
|
|
|
120
176
|
RestController,
|
|
121
177
|
UseDependency,
|
|
122
178
|
UseMiddleware,
|
|
179
|
+
compose_route_decorators,
|
|
123
180
|
)
|
|
124
181
|
from .presentation.http_microservice import HttpMicroservice, HttpMiddleware
|
|
125
182
|
from .presentation.server import create_http_server
|
|
@@ -137,10 +194,18 @@ if TYPE_CHECKING:
|
|
|
137
194
|
from .presentation.websocket.websocket_interceptor import WebSocketInterceptor
|
|
138
195
|
from .scheduler.decorators import ScheduledAction
|
|
139
196
|
from .tools.app_config.interceptor import AppConfigurationInterceptor
|
|
197
|
+
from .tools.typescript.decorators import (
|
|
198
|
+
ExposeType,
|
|
199
|
+
MutationEndpoint,
|
|
200
|
+
QueryEndpoint,
|
|
201
|
+
SplitInputOutput,
|
|
202
|
+
)
|
|
140
203
|
|
|
141
204
|
__all__ = [
|
|
142
205
|
"SetMetadata",
|
|
143
|
-
"
|
|
206
|
+
"start_transaction_metadata_context",
|
|
207
|
+
"start_providing_metadata",
|
|
208
|
+
"TransactionMetadata",
|
|
144
209
|
"get_metadata",
|
|
145
210
|
"get_all_metadata",
|
|
146
211
|
"get_metadata_value",
|
|
@@ -162,6 +227,7 @@ if TYPE_CHECKING:
|
|
|
162
227
|
"RegisterWebSocketMessage",
|
|
163
228
|
"TracedRequestMiddleware",
|
|
164
229
|
"raises_http_exception_on",
|
|
230
|
+
"PresentationException",
|
|
165
231
|
"raises_200_on",
|
|
166
232
|
"raises_422_on",
|
|
167
233
|
"raises_404_on",
|
|
@@ -183,9 +249,29 @@ if TYPE_CHECKING:
|
|
|
183
249
|
"HttpPut",
|
|
184
250
|
"HttpDelete",
|
|
185
251
|
"ObservabilityInterceptor",
|
|
252
|
+
"TracedFunc",
|
|
253
|
+
"TracedClass",
|
|
254
|
+
"traced_class",
|
|
255
|
+
"start_span",
|
|
256
|
+
"add_span_link",
|
|
257
|
+
"get_current_span",
|
|
258
|
+
"get_current_span_context",
|
|
259
|
+
"spawn_trace",
|
|
260
|
+
"set_span_attribute",
|
|
261
|
+
"add_event",
|
|
262
|
+
"setup_fastapi_exception_handler",
|
|
263
|
+
"set_span_status",
|
|
264
|
+
"record_exception",
|
|
265
|
+
"get_tracing_provider",
|
|
186
266
|
"QueryInjector",
|
|
187
267
|
"HttpMicroservice",
|
|
188
268
|
"use_current_container",
|
|
269
|
+
"use_app_context",
|
|
270
|
+
"use_app_transaction_context",
|
|
271
|
+
"use_app_tx_ctx_data",
|
|
272
|
+
"is_shutting_down",
|
|
273
|
+
"request_shutdown",
|
|
274
|
+
"Microservice",
|
|
189
275
|
"T_BASEMODEL",
|
|
190
276
|
"DatedEntity",
|
|
191
277
|
"BaseEntity",
|
|
@@ -208,7 +294,6 @@ if TYPE_CHECKING:
|
|
|
208
294
|
"MessageBusController",
|
|
209
295
|
"MessageHandler",
|
|
210
296
|
"ScheduledAction",
|
|
211
|
-
"Microservice",
|
|
212
297
|
"ProviderSpec",
|
|
213
298
|
"Token",
|
|
214
299
|
"AIOSqlAlchemySessionInterceptor",
|
|
@@ -220,6 +305,9 @@ if TYPE_CHECKING:
|
|
|
220
305
|
"use_transaction",
|
|
221
306
|
"providing_session",
|
|
222
307
|
"provide_session",
|
|
308
|
+
"uses_persistence_session",
|
|
309
|
+
"skip_persistence_session",
|
|
310
|
+
"set_use_persistence_session",
|
|
223
311
|
"providing_transaction",
|
|
224
312
|
"providing_new_session",
|
|
225
313
|
"Post",
|
|
@@ -233,8 +321,13 @@ if TYPE_CHECKING:
|
|
|
233
321
|
"MessageBusPublisherInterceptor",
|
|
234
322
|
"RedisWebSocketConnectionBackend",
|
|
235
323
|
"AppConfigurationInterceptor",
|
|
324
|
+
"ExposeType",
|
|
325
|
+
"QueryEndpoint",
|
|
326
|
+
"MutationEndpoint",
|
|
327
|
+
"SplitInputOutput",
|
|
236
328
|
"UseMiddleware",
|
|
237
329
|
"UseDependency",
|
|
330
|
+
"compose_route_decorators",
|
|
238
331
|
"GlobalHttpErrorHandler",
|
|
239
332
|
"RouteHttpErrorHandler",
|
|
240
333
|
"WebSocketMessage",
|
|
@@ -242,10 +335,29 @@ if TYPE_CHECKING:
|
|
|
242
335
|
"provide_ws_manager",
|
|
243
336
|
"HttpRpcClientBuilder",
|
|
244
337
|
"HTTPXHttpRPCAsyncBackend",
|
|
245
|
-
|
|
246
|
-
"
|
|
247
|
-
"
|
|
338
|
+
# New request parameter decorators
|
|
339
|
+
"FormData",
|
|
340
|
+
"File",
|
|
341
|
+
# Configuration decorators
|
|
342
|
+
"Timeout",
|
|
343
|
+
"Retry",
|
|
344
|
+
"ContentType",
|
|
345
|
+
# Authentication classes
|
|
346
|
+
"BearerTokenAuth",
|
|
347
|
+
"BasicAuth",
|
|
348
|
+
"ApiKeyAuth",
|
|
349
|
+
# Middleware classes
|
|
350
|
+
"CacheMiddleware",
|
|
351
|
+
"AuthenticationMiddleware",
|
|
352
|
+
"ResponseMiddleware",
|
|
353
|
+
"RequestHook",
|
|
354
|
+
"ResponseHook",
|
|
355
|
+
# Configuration classes
|
|
356
|
+
"RetryConfig",
|
|
357
|
+
# Exception classes
|
|
358
|
+
"TimeoutException",
|
|
248
359
|
"AppTransactionContext",
|
|
360
|
+
"use_app_type",
|
|
249
361
|
"AppContext",
|
|
250
362
|
"ControllerMemberReflect",
|
|
251
363
|
"ControllerReflect",
|
|
@@ -257,7 +369,9 @@ __SPEC_PARENT__: str = __spec__.parent # type: ignore
|
|
|
257
369
|
# A mapping of {<member name>: (package, <module name>)} defining dynamic imports
|
|
258
370
|
_dynamic_imports: "dict[str, tuple[str, str, str | None]]" = {
|
|
259
371
|
"SetMetadata": (__SPEC_PARENT__, "reflect.metadata", None),
|
|
260
|
-
"
|
|
372
|
+
"TransactionMetadata": (__SPEC_PARENT__, "reflect.metadata", None),
|
|
373
|
+
"start_transaction_metadata_context": (__SPEC_PARENT__, "reflect.metadata", None),
|
|
374
|
+
"start_providing_metadata": (__SPEC_PARENT__, "reflect.metadata", None),
|
|
261
375
|
"get_metadata": (__SPEC_PARENT__, "reflect.metadata", None),
|
|
262
376
|
"get_all_metadata": (__SPEC_PARENT__, "reflect.metadata", None),
|
|
263
377
|
"get_metadata_value": (__SPEC_PARENT__, "reflect.metadata", None),
|
|
@@ -301,6 +415,7 @@ _dynamic_imports: "dict[str, tuple[str, str, str | None]]" = {
|
|
|
301
415
|
),
|
|
302
416
|
"TracedRequestMiddleware": (__SPEC_PARENT__, "rpc.http.backends.otel", None),
|
|
303
417
|
"raises_http_exception_on": (__SPEC_PARENT__, "presentation.hooks", None),
|
|
418
|
+
"PresentationException": (__SPEC_PARENT__, "presentation.exceptions", None),
|
|
304
419
|
"raises_200_on": (__SPEC_PARENT__, "presentation.hooks", None),
|
|
305
420
|
"raises_400_on": (__SPEC_PARENT__, "presentation.hooks", None),
|
|
306
421
|
"raises_401_on": (__SPEC_PARENT__, "presentation.hooks", None),
|
|
@@ -322,6 +437,24 @@ _dynamic_imports: "dict[str, tuple[str, str, str | None]]" = {
|
|
|
322
437
|
"HttpPut": (__SPEC_PARENT__, "rpc.http.decorators", "Put"),
|
|
323
438
|
"HttpDelete": (__SPEC_PARENT__, "rpc.http.decorators", "Delete"),
|
|
324
439
|
"ObservabilityInterceptor": (__SPEC_PARENT__, "observability.interceptor", None),
|
|
440
|
+
"TracedFunc": (__SPEC_PARENT__, "observability.decorators", None),
|
|
441
|
+
"TracedClass": (__SPEC_PARENT__, "observability.decorators", None),
|
|
442
|
+
"traced_class": (__SPEC_PARENT__, "observability.decorators", None),
|
|
443
|
+
"spawn_trace": (__SPEC_PARENT__, "observability.hooks", None),
|
|
444
|
+
"setup_fastapi_exception_handler": (
|
|
445
|
+
__SPEC_PARENT__,
|
|
446
|
+
"observability.fastapi_exception_handler",
|
|
447
|
+
None,
|
|
448
|
+
),
|
|
449
|
+
"set_span_attribute": (__SPEC_PARENT__, "observability.hooks", None),
|
|
450
|
+
"start_span": (__SPEC_PARENT__, "observability.hooks", None),
|
|
451
|
+
"add_span_link": (__SPEC_PARENT__, "observability.hooks", None),
|
|
452
|
+
"get_current_span": (__SPEC_PARENT__, "observability.hooks", None),
|
|
453
|
+
"get_current_span_context": (__SPEC_PARENT__, "observability.hooks", None),
|
|
454
|
+
"add_event": (__SPEC_PARENT__, "observability.hooks", None),
|
|
455
|
+
"set_span_status": (__SPEC_PARENT__, "observability.hooks", None),
|
|
456
|
+
"record_exception": (__SPEC_PARENT__, "observability.hooks", None),
|
|
457
|
+
"get_tracing_provider": (__SPEC_PARENT__, "observability.hooks", None),
|
|
325
458
|
"QueryInjector": (__SPEC_PARENT__, "persistence.utilities", None),
|
|
326
459
|
"HttpMicroservice": (__SPEC_PARENT__, "presentation.http_microservice", None),
|
|
327
460
|
"use_current_container": (__SPEC_PARENT__, "microservice", None),
|
|
@@ -401,6 +534,21 @@ _dynamic_imports: "dict[str, tuple[str, str, str | None]]" = {
|
|
|
401
534
|
"persistence.interceptors.aiosqa_interceptor",
|
|
402
535
|
None,
|
|
403
536
|
),
|
|
537
|
+
"uses_persistence_session": (
|
|
538
|
+
__SPEC_PARENT__,
|
|
539
|
+
"persistence.interceptors.decorators",
|
|
540
|
+
None,
|
|
541
|
+
),
|
|
542
|
+
"skip_persistence_session": (
|
|
543
|
+
__SPEC_PARENT__,
|
|
544
|
+
"persistence.interceptors.decorators",
|
|
545
|
+
None,
|
|
546
|
+
),
|
|
547
|
+
"set_use_persistence_session": (
|
|
548
|
+
__SPEC_PARENT__,
|
|
549
|
+
"persistence.interceptors.decorators",
|
|
550
|
+
None,
|
|
551
|
+
),
|
|
404
552
|
"Post": (__SPEC_PARENT__, "presentation.decorators", None),
|
|
405
553
|
"Get": (__SPEC_PARENT__, "presentation.decorators", None),
|
|
406
554
|
"Patch": (__SPEC_PARENT__, "presentation.decorators", None),
|
|
@@ -427,8 +575,13 @@ _dynamic_imports: "dict[str, tuple[str, str, str | None]]" = {
|
|
|
427
575
|
"tools.app_config.interceptor",
|
|
428
576
|
None,
|
|
429
577
|
),
|
|
578
|
+
"ExposeType": (__SPEC_PARENT__, "tools.typescript.decorators", None),
|
|
579
|
+
"QueryEndpoint": (__SPEC_PARENT__, "tools.typescript.decorators", None),
|
|
580
|
+
"MutationEndpoint": (__SPEC_PARENT__, "tools.typescript.decorators", None),
|
|
581
|
+
"SplitInputOutput": (__SPEC_PARENT__, "tools.typescript.decorators", None),
|
|
430
582
|
"UseMiddleware": (__SPEC_PARENT__, "presentation.decorators", None),
|
|
431
583
|
"UseDependency": (__SPEC_PARENT__, "presentation.decorators", None),
|
|
584
|
+
"compose_route_decorators": (__SPEC_PARENT__, "presentation.decorators", None),
|
|
432
585
|
"GlobalHttpErrorHandler": (__SPEC_PARENT__, "rpc.http.decorators", None),
|
|
433
586
|
"RouteHttpErrorHandler": (__SPEC_PARENT__, "rpc.http.decorators", None),
|
|
434
587
|
"WebSocketMessage": (__SPEC_PARENT__, "presentation.websocket.types", None),
|
|
@@ -440,12 +593,31 @@ _dynamic_imports: "dict[str, tuple[str, str, str | None]]" = {
|
|
|
440
593
|
"provide_ws_manager": (__SPEC_PARENT__, "presentation.websocket.context", None),
|
|
441
594
|
"HttpRpcClientBuilder": (__SPEC_PARENT__, "rpc.http.decorators", None),
|
|
442
595
|
"HTTPXHttpRPCAsyncBackend": (__SPEC_PARENT__, "rpc.http.backends.httpx", None),
|
|
596
|
+
# New HTTP RPC classes
|
|
597
|
+
"FormData": (__SPEC_PARENT__, "rpc.http.decorators", None),
|
|
598
|
+
"File": (__SPEC_PARENT__, "rpc.http.decorators", None),
|
|
599
|
+
"Timeout": (__SPEC_PARENT__, "rpc.http.decorators", None),
|
|
600
|
+
"Retry": (__SPEC_PARENT__, "rpc.http.decorators", None),
|
|
601
|
+
"ContentType": (__SPEC_PARENT__, "rpc.http.decorators", None),
|
|
602
|
+
"BearerTokenAuth": (__SPEC_PARENT__, "rpc.http.decorators", None),
|
|
603
|
+
"BasicAuth": (__SPEC_PARENT__, "rpc.http.decorators", None),
|
|
604
|
+
"ApiKeyAuth": (__SPEC_PARENT__, "rpc.http.decorators", None),
|
|
605
|
+
"CacheMiddleware": (__SPEC_PARENT__, "rpc.http.decorators", None),
|
|
606
|
+
"AuthenticationMiddleware": (__SPEC_PARENT__, "rpc.http.decorators", None),
|
|
607
|
+
"ResponseMiddleware": (__SPEC_PARENT__, "rpc.http.decorators", None),
|
|
608
|
+
"RequestHook": (__SPEC_PARENT__, "rpc.http.decorators", None),
|
|
609
|
+
"ResponseHook": (__SPEC_PARENT__, "rpc.http.decorators", None),
|
|
610
|
+
"RetryConfig": (__SPEC_PARENT__, "rpc.http.decorators", None),
|
|
611
|
+
"TimeoutException": (__SPEC_PARENT__, "rpc.http.decorators", None),
|
|
443
612
|
"use_app_context": (__SPEC_PARENT__, "microservice", None),
|
|
444
613
|
"use_app_transaction_context": (__SPEC_PARENT__, "microservice", None),
|
|
445
614
|
"use_app_tx_ctx_data": (__SPEC_PARENT__, "microservice", None),
|
|
615
|
+
"is_shutting_down": (__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
|