updated event and router stacks

This commit is contained in:
2025-04-22 00:57:06 +03:00
parent 35aab0ba11
commit 9069ba0754
40 changed files with 531 additions and 352 deletions

View File

@@ -1,5 +1,10 @@
from .template.event import template_event_cluster
from .template.cluster import (
TemplateEventClusterSet
)
__all__ = [
"template_event_cluster",
"TemplateEventClusterSet",
]
def retrieve_all_clusters():
return [TemplateEventClusterSet]

View File

@@ -0,0 +1,15 @@
from ApiServices.TemplateService.initializer.event_clusters import EventCluster, SetEventCluster
TemplateEventCluster = EventCluster(
endpoint_uu_id="bb20c8c6-a289-4cab-9da7-34ca8a36c8e5"
)
OtherTemplateEventCluster = EventCluster(
endpoint_uu_id="ecb82b7a-317f-469d-a682-ff431f152453"
)
TemplateEventClusterSet = SetEventCluster()
TemplateEventClusterSet.add_event_cluster(TemplateEventCluster)
TemplateEventClusterSet.add_event_cluster(OtherTemplateEventCluster)

View File

@@ -1,5 +1,8 @@
from ApiServices.TemplateService.initializer.event_clusters import EventCluster, Event
from ApiServices.TemplateService.initializer.event_clusters import Event
from .cluster import (
template_event_cluster,
other_template_event_cluster,
)
single_event = Event(
name="example_event",
@@ -25,10 +28,11 @@ def example_callable():
single_event.event_callable = example_callable
template_event_cluster.add_event([single_event])
other_event = Event(
name="example_event-2",
key="176b829c-7622-4cf2-b474-421e5acb637c",
key="36b26d7c-2a9e-4006-a213-f54bc66e5455",
request_validator=None, # TODO: Add request validator
response_validator=None, # TODO: Add response validator
description="Example event 2 description",
@@ -50,17 +54,4 @@ def example_callable_other():
other_event.event_callable = example_callable_other
tokens_in_redis = [
"3f510dcf-9f84-4eb9-b919-f582f30adab1",
"9f403034-deba-4e1f-b43e-b25d3c808d39",
"b8ec6e64-286a-4f60-8554-7a3865454944",
"176b829c-7622-4cf2-b474-421e5acb637c",
]
template_event_cluster = EventCluster(
endpoint_uu_id="bb20c8c6-a289-4cab-9da7-34ca8a36c8e5"
)
template_event_cluster.add_event([single_event, other_event])
# matched_event = template_event_cluster.match_event(event_keys=tokens_in_redis)
# print('event_callable', matched_event.event_callable())
other_template_event_cluster.add_event([other_event])