hexkit 3.2.0__tar.gz → 3.2.2__tar.gz
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.
- {hexkit-3.2.0/src/hexkit.egg-info → hexkit-3.2.2}/PKG-INFO +1 -1
- {hexkit-3.2.0 → hexkit-3.2.2}/pyproject.toml +1 -1
- {hexkit-3.2.0 → hexkit-3.2.2}/src/hexkit/correlation.py +15 -1
- {hexkit-3.2.0 → hexkit-3.2.2}/src/hexkit/providers/mongokafka/provider.py +1 -1
- {hexkit-3.2.0 → hexkit-3.2.2/src/hexkit.egg-info}/PKG-INFO +1 -1
- {hexkit-3.2.0 → hexkit-3.2.2}/LICENSE +0 -0
- {hexkit-3.2.0 → hexkit-3.2.2}/MANIFEST.in +0 -0
- {hexkit-3.2.0 → hexkit-3.2.2}/README.md +0 -0
- {hexkit-3.2.0 → hexkit-3.2.2}/setup.cfg +0 -0
- {hexkit-3.2.0 → hexkit-3.2.2}/src/hexkit/__init__.py +0 -0
- {hexkit-3.2.0 → hexkit-3.2.2}/src/hexkit/__main__.py +0 -0
- {hexkit-3.2.0 → hexkit-3.2.2}/src/hexkit/base.py +0 -0
- {hexkit-3.2.0 → hexkit-3.2.2}/src/hexkit/config.py +0 -0
- {hexkit-3.2.0 → hexkit-3.2.2}/src/hexkit/custom_types.py +0 -0
- {hexkit-3.2.0 → hexkit-3.2.2}/src/hexkit/log.py +0 -0
- {hexkit-3.2.0 → hexkit-3.2.2}/src/hexkit/protocols/__init__.py +0 -0
- {hexkit-3.2.0 → hexkit-3.2.2}/src/hexkit/protocols/dao.py +0 -0
- {hexkit-3.2.0 → hexkit-3.2.2}/src/hexkit/protocols/daopub.py +0 -0
- {hexkit-3.2.0 → hexkit-3.2.2}/src/hexkit/protocols/daosub.py +0 -0
- {hexkit-3.2.0 → hexkit-3.2.2}/src/hexkit/protocols/eventpub.py +0 -0
- {hexkit-3.2.0 → hexkit-3.2.2}/src/hexkit/protocols/eventsub.py +0 -0
- {hexkit-3.2.0 → hexkit-3.2.2}/src/hexkit/protocols/objstorage.py +0 -0
- {hexkit-3.2.0 → hexkit-3.2.2}/src/hexkit/providers/__init__.py +0 -0
- {hexkit-3.2.0 → hexkit-3.2.2}/src/hexkit/providers/akafka/__init__.py +0 -0
- {hexkit-3.2.0 → hexkit-3.2.2}/src/hexkit/providers/akafka/config.py +0 -0
- {hexkit-3.2.0 → hexkit-3.2.2}/src/hexkit/providers/akafka/provider/__init__.py +0 -0
- {hexkit-3.2.0 → hexkit-3.2.2}/src/hexkit/providers/akafka/provider/daosub.py +0 -0
- {hexkit-3.2.0 → hexkit-3.2.2}/src/hexkit/providers/akafka/provider/eventpub.py +0 -0
- {hexkit-3.2.0 → hexkit-3.2.2}/src/hexkit/providers/akafka/provider/eventsub.py +0 -0
- {hexkit-3.2.0 → hexkit-3.2.2}/src/hexkit/providers/akafka/provider/utils.py +0 -0
- {hexkit-3.2.0 → hexkit-3.2.2}/src/hexkit/providers/akafka/testcontainer.py +0 -0
- {hexkit-3.2.0 → hexkit-3.2.2}/src/hexkit/providers/akafka/testutils.py +0 -0
- {hexkit-3.2.0 → hexkit-3.2.2}/src/hexkit/providers/mongodb/__init__.py +0 -0
- {hexkit-3.2.0 → hexkit-3.2.2}/src/hexkit/providers/mongodb/provider.py +0 -0
- {hexkit-3.2.0 → hexkit-3.2.2}/src/hexkit/providers/mongodb/testutils.py +0 -0
- {hexkit-3.2.0 → hexkit-3.2.2}/src/hexkit/providers/mongokafka/__init__.py +0 -0
- {hexkit-3.2.0 → hexkit-3.2.2}/src/hexkit/providers/mongokafka/testutils.py +0 -0
- {hexkit-3.2.0 → hexkit-3.2.2}/src/hexkit/providers/s3/__init__.py +0 -0
- {hexkit-3.2.0 → hexkit-3.2.2}/src/hexkit/providers/s3/provider.py +0 -0
- {hexkit-3.2.0 → hexkit-3.2.2}/src/hexkit/providers/s3/test_files/__init__.py +0 -0
- {hexkit-3.2.0 → hexkit-3.2.2}/src/hexkit/providers/s3/test_files/test_file1.yaml +0 -0
- {hexkit-3.2.0 → hexkit-3.2.2}/src/hexkit/providers/s3/test_files/test_file2.yaml +0 -0
- {hexkit-3.2.0 → hexkit-3.2.2}/src/hexkit/providers/s3/test_files/test_file3.yaml +0 -0
- {hexkit-3.2.0 → hexkit-3.2.2}/src/hexkit/providers/s3/test_files/test_file4.yaml +0 -0
- {hexkit-3.2.0 → hexkit-3.2.2}/src/hexkit/providers/s3/testutils.py +0 -0
- {hexkit-3.2.0 → hexkit-3.2.2}/src/hexkit/providers/testing/__init__.py +0 -0
- {hexkit-3.2.0 → hexkit-3.2.2}/src/hexkit/providers/testing/eventpub.py +0 -0
- {hexkit-3.2.0 → hexkit-3.2.2}/src/hexkit/py.typed +0 -0
- {hexkit-3.2.0 → hexkit-3.2.2}/src/hexkit/utils.py +0 -0
- {hexkit-3.2.0 → hexkit-3.2.2}/src/hexkit.egg-info/SOURCES.txt +0 -0
- {hexkit-3.2.0 → hexkit-3.2.2}/src/hexkit.egg-info/dependency_links.txt +0 -0
- {hexkit-3.2.0 → hexkit-3.2.2}/src/hexkit.egg-info/requires.txt +0 -0
- {hexkit-3.2.0 → hexkit-3.2.2}/src/hexkit.egg-info/top_level.txt +0 -0
|
@@ -29,6 +29,7 @@ correlation_id_var: ContextVar[str] = ContextVar("correlation_id", default="")
|
|
|
29
29
|
|
|
30
30
|
__all__ = [
|
|
31
31
|
"set_correlation_id",
|
|
32
|
+
"set_new_correlation_id",
|
|
32
33
|
"get_correlation_id",
|
|
33
34
|
"new_correlation_id",
|
|
34
35
|
"validate_correlation_id",
|
|
@@ -40,6 +41,9 @@ __all__ = [
|
|
|
40
41
|
class CorrelationIdContextError(RuntimeError):
|
|
41
42
|
"""Raised when the correlation ID ContextVar is unexpectedly not set."""
|
|
42
43
|
|
|
44
|
+
def __init__(self):
|
|
45
|
+
super().__init__("No correlation ID has been set.")
|
|
46
|
+
|
|
43
47
|
|
|
44
48
|
class InvalidCorrelationIdError(RuntimeError):
|
|
45
49
|
"""Raised when a correlation ID fails validation."""
|
|
@@ -68,7 +72,7 @@ def validate_correlation_id(correlation_id: str):
|
|
|
68
72
|
|
|
69
73
|
@asynccontextmanager
|
|
70
74
|
async def set_correlation_id(correlation_id: str):
|
|
71
|
-
"""Set the correlation ID for the life of the context.
|
|
75
|
+
"""Set the given correlation ID for the life of the context.
|
|
72
76
|
|
|
73
77
|
Raises:
|
|
74
78
|
InvalidCorrelationIdError: when the correlation ID is empty or invalid.
|
|
@@ -80,6 +84,16 @@ async def set_correlation_id(correlation_id: str):
|
|
|
80
84
|
yield
|
|
81
85
|
|
|
82
86
|
|
|
87
|
+
@asynccontextmanager
|
|
88
|
+
async def set_new_correlation_id():
|
|
89
|
+
"""Set a new correlation ID for the life of the context."""
|
|
90
|
+
correlation_id = new_correlation_id()
|
|
91
|
+
|
|
92
|
+
async with set_context_var(correlation_id_var, correlation_id):
|
|
93
|
+
log.info("Set context correlation ID to %s", correlation_id)
|
|
94
|
+
yield correlation_id
|
|
95
|
+
|
|
96
|
+
|
|
83
97
|
def get_correlation_id() -> str:
|
|
84
98
|
"""Get the correlation ID.
|
|
85
99
|
|
|
@@ -251,7 +251,7 @@ class MongoKafkaDaoPublisher(Generic[Dto]):
|
|
|
251
251
|
"""
|
|
252
252
|
correlation_id = get_correlation_id()
|
|
253
253
|
document = self._dao._dto_to_document(dto)
|
|
254
|
-
document["
|
|
254
|
+
document.setdefault("__metadata__", {})["correlation_id"] = correlation_id
|
|
255
255
|
result = await self._collection.replace_one(
|
|
256
256
|
{"_id": document["_id"], "__metadata__.deleted": False}, document
|
|
257
257
|
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|