fdc-shared-kernel 0.0.34__tar.gz → 0.0.35__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.
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/PKG-INFO +1 -1
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/fdc_shared_kernel.egg-info/PKG-INFO +1 -1
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/fdc_shared_kernel.egg-info/SOURCES.txt +1 -1
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/pyproject.toml +1 -1
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/messaging/__init__.py +2 -2
- fdc_shared_kernel-0.0.34/shared_kernel/messaging/event_bridge_sqs_databus.py → fdc_shared_kernel-0.0.35/shared_kernel/messaging/aws_databus.py +29 -17
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/README.md +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/README_pypi.md +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/fdc_shared_kernel.egg-info/dependency_links.txt +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/fdc_shared_kernel.egg-info/requires.txt +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/fdc_shared_kernel.egg-info/top_level.txt +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/requirements.txt +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/setup.cfg +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/__init__.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/async_task_executor/__init__.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/async_task_executor/async_task_executor.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/auth/__init__.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/auth/jwt_helper.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/auth/token_handler.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/config/__init__.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/database/__init__.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/enums/__init__.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/enums/async_task_status.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/exceptions/__init__.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/exceptions/configuration_exceptions.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/exceptions/custom_exceptions.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/exceptions/data_validation_exceptions.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/exceptions/http_exceptions.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/exceptions/infrastructure_exceptions.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/exceptions/operational_exceptions.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/exceptions/security_exceptions.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/http/__init__.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/http/httpx_http_client.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/http/request_http_client.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/interfaces/__init__.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/interfaces/databus.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/interfaces/http.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/interfaces/keyvault.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/logger/__init__.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/messaging/http_databus.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/messaging/nats_databus.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/metrics/__init__.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/metrics/status_tracker.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/models/__init__.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/security/__init__.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/security/key_vault/__init__.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/security/key_vault/aws_secret_manager.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/security/key_vault/azure_keyvault.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/tests/__init__.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/tests/config/__init__.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/tests/config/test_config.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/tests/logger/__init__.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/tests/logger/test_logger.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/tests/messaging/__init__.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/tests/messaging/test_nats_interface.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/tests/utils/__init__.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/tests/utils/test_data_validators.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/tests/utils/test_date_format_utils.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/tests/utils/test_string_utils.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/utils/__init__.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/utils/data_validators_utils.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/utils/date_format_utils.py +0 -0
- {fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/utils/string_utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: fdc_shared_kernel
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.35
|
|
4
4
|
Summary: Shared library for microservice
|
|
5
5
|
Author-email: Shikhil S <shikhil.s@dbizsolution.com>, Ahammed Akdham N <ahammedakdham.n@dbizsolution.com>
|
|
6
6
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: fdc_shared_kernel
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.35
|
|
4
4
|
Summary: Shared library for microservice
|
|
5
5
|
Author-email: Shikhil S <shikhil.s@dbizsolution.com>, Ahammed Akdham N <ahammedakdham.n@dbizsolution.com>
|
|
6
6
|
Classifier: Programming Language :: Python :: 3
|
{fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/fdc_shared_kernel.egg-info/SOURCES.txt
RENAMED
|
@@ -34,7 +34,7 @@ shared_kernel/interfaces/http.py
|
|
|
34
34
|
shared_kernel/interfaces/keyvault.py
|
|
35
35
|
shared_kernel/logger/__init__.py
|
|
36
36
|
shared_kernel/messaging/__init__.py
|
|
37
|
-
shared_kernel/messaging/
|
|
37
|
+
shared_kernel/messaging/aws_databus.py
|
|
38
38
|
shared_kernel/messaging/http_databus.py
|
|
39
39
|
shared_kernel/messaging/nats_databus.py
|
|
40
40
|
shared_kernel/metrics/__init__.py
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from shared_kernel.messaging.nats_databus import NATSDataBus
|
|
2
2
|
from shared_kernel.messaging.http_databus import HTTPDataBus
|
|
3
|
-
from shared_kernel.messaging.event_bridge_sqs_databus import
|
|
3
|
+
from shared_kernel.messaging.event_bridge_sqs_databus import AWSDataBus
|
|
4
4
|
from shared_kernel.interfaces import DataBus
|
|
5
5
|
|
|
6
6
|
|
|
@@ -9,7 +9,7 @@ class DataBus:
|
|
|
9
9
|
data_bus_classes = {
|
|
10
10
|
"NATS": NATSDataBus,
|
|
11
11
|
"HTTP": HTTPDataBus,
|
|
12
|
-
"
|
|
12
|
+
"AWS": AWSDataBus,
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
@staticmethod
|
|
@@ -8,7 +8,8 @@ import threading
|
|
|
8
8
|
|
|
9
9
|
logging.getLogger().setLevel(logging.INFO)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
class AWSDataBus:
|
|
12
13
|
"""
|
|
13
14
|
An EventBridge and SQS interface class to handle event-driven communication.
|
|
14
15
|
"""
|
|
@@ -16,12 +17,12 @@ class EventBridgeSQSDataBus:
|
|
|
16
17
|
|
|
17
18
|
def __new__(cls, *args, **kwargs):
|
|
18
19
|
if cls._instance is None:
|
|
19
|
-
cls._instance = super(
|
|
20
|
+
cls._instance = super(AWSDataBus, cls).__new__(cls)
|
|
20
21
|
return cls._instance
|
|
21
22
|
|
|
22
23
|
def __init__(self, config: Dict = None):
|
|
23
24
|
"""
|
|
24
|
-
Initialize the
|
|
25
|
+
Initialize the AWSDataBus and start listening to the SQS queue.
|
|
25
26
|
Args:
|
|
26
27
|
config (Dict): A dictionary containing the EventBridge and SQS configuration.
|
|
27
28
|
"""
|
|
@@ -31,16 +32,18 @@ class EventBridgeSQSDataBus:
|
|
|
31
32
|
self.sqs = boto3.client('sqs')
|
|
32
33
|
self.event_bus_name = config.get('event_bus_name')
|
|
33
34
|
self.queue_url = config.get('queue_url')
|
|
35
|
+
self.queue_arn = config.get("queue_arn")
|
|
36
|
+
self.source_name = config.get("source_name")
|
|
34
37
|
self.callback_registry = {} # Store callbacks for subscribed events
|
|
35
38
|
self.initialized = True
|
|
36
39
|
self.stop_event = threading.Event()
|
|
37
|
-
|
|
40
|
+
|
|
38
41
|
if self.queue_url:
|
|
39
42
|
# Start listening to the SQS queue as soon as initialized in a thread pool
|
|
40
43
|
self.executor = ThreadPoolExecutor(max_workers=4)
|
|
41
44
|
self.executor.submit(self._start_listening)
|
|
42
45
|
|
|
43
|
-
def subscribe_async_event(self, event_name: str,
|
|
46
|
+
def subscribe_async_event(self, event_name: str, callback: Callable[[Any], None]):
|
|
44
47
|
"""
|
|
45
48
|
Subscribe to an event by creating an EventBridge rule and store the callback for the event.
|
|
46
49
|
Args:
|
|
@@ -49,6 +52,12 @@ class EventBridgeSQSDataBus:
|
|
|
49
52
|
callback (Callable[[Any], None]): The callback function to be invoked when the event is received.
|
|
50
53
|
"""
|
|
51
54
|
rule_name = f'{event_name}_rule'
|
|
55
|
+
event_pattern = json.dumps(
|
|
56
|
+
{
|
|
57
|
+
"source": [self.source_name], # Use self.source_name as the source
|
|
58
|
+
"detail-type": [event_name],
|
|
59
|
+
}
|
|
60
|
+
)
|
|
52
61
|
try:
|
|
53
62
|
# Create EventBridge Rule
|
|
54
63
|
self.eventbridge.put_rule(
|
|
@@ -63,10 +72,12 @@ class EventBridgeSQSDataBus:
|
|
|
63
72
|
self.eventbridge.put_targets(
|
|
64
73
|
Rule=rule_name,
|
|
65
74
|
EventBusName=self.event_bus_name,
|
|
66
|
-
Targets=[
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
75
|
+
Targets=[
|
|
76
|
+
{
|
|
77
|
+
"Id": f"{event_name}_sqs_target",
|
|
78
|
+
"Arn": self.queue_arn, # SQS queue ARN
|
|
79
|
+
}
|
|
80
|
+
],
|
|
70
81
|
)
|
|
71
82
|
logging.info(f"SQS queue target added to rule '{rule_name}'.")
|
|
72
83
|
|
|
@@ -121,7 +132,7 @@ class EventBridgeSQSDataBus:
|
|
|
121
132
|
except Exception as e:
|
|
122
133
|
logging.error(f"Error processing message: {e}")
|
|
123
134
|
|
|
124
|
-
def publish_event(self, event_name: str, event_payload: dict):
|
|
135
|
+
def publish_event(self, event_name: str, source_name: str, event_payload: dict):
|
|
125
136
|
"""
|
|
126
137
|
Publish an event to the EventBridge.
|
|
127
138
|
Args:
|
|
@@ -132,12 +143,14 @@ class EventBridgeSQSDataBus:
|
|
|
132
143
|
"""
|
|
133
144
|
try:
|
|
134
145
|
response = self.eventbridge.put_events(
|
|
135
|
-
Entries=[
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
146
|
+
Entries=[
|
|
147
|
+
{
|
|
148
|
+
"Source": self.source_name,
|
|
149
|
+
"DetailType": event_name,
|
|
150
|
+
"Detail": json.dumps(event_payload),
|
|
151
|
+
"EventBusName": self.event_bus_name,
|
|
152
|
+
}
|
|
153
|
+
]
|
|
141
154
|
)
|
|
142
155
|
logging.info(f"Published event '{event_name}': {event_payload}, response: {response}")
|
|
143
156
|
return True
|
|
@@ -159,4 +172,3 @@ class EventBridgeSQSDataBus:
|
|
|
159
172
|
logging.info(f"Message deleted from SQS queue with receipt handle '{receipt_handle}'.")
|
|
160
173
|
except ClientError as e:
|
|
161
174
|
logging.error(f"Failed to delete message from SQS: {e}")
|
|
162
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/fdc_shared_kernel.egg-info/requires.txt
RENAMED
|
File without changes
|
{fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/fdc_shared_kernel.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/async_task_executor/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/enums/async_task_status.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/exceptions/custom_exceptions.py
RENAMED
|
File without changes
|
|
File without changes
|
{fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/exceptions/http_exceptions.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/http/httpx_http_client.py
RENAMED
|
File without changes
|
{fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/http/request_http_client.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/messaging/http_databus.py
RENAMED
|
File without changes
|
{fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/messaging/nats_databus.py
RENAMED
|
File without changes
|
|
File without changes
|
{fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/metrics/status_tracker.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/security/key_vault/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/tests/config/__init__.py
RENAMED
|
File without changes
|
{fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/tests/config/test_config.py
RENAMED
|
File without changes
|
{fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/tests/logger/__init__.py
RENAMED
|
File without changes
|
{fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/tests/logger/test_logger.py
RENAMED
|
File without changes
|
{fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/tests/messaging/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/tests/utils/test_string_utils.py
RENAMED
|
File without changes
|
|
File without changes
|
{fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/utils/data_validators_utils.py
RENAMED
|
File without changes
|
{fdc_shared_kernel-0.0.34 → fdc_shared_kernel-0.0.35}/shared_kernel/utils/date_format_utils.py
RENAMED
|
File without changes
|
|
File without changes
|