Skip to content

Commit 527a8bf

Browse files
committed
rename 'DirectMessageParams' to 'IntersectDirectMessageParams'
Signed-off-by: Lance Drane <dranelt@ornl.gov>
1 parent f806ee6 commit 527a8bf

File tree

12 files changed

+42
-38
lines changed

12 files changed

+42
-38
lines changed

examples/1_hello_world/hello_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
from intersect_sdk import (
44
INTERSECT_JSON_VALUE,
5-
DirectMessageParams,
65
IntersectClient,
76
IntersectClientCallback,
87
IntersectClientConfig,
8+
IntersectDirectMessageParams,
99
default_intersect_lifecycle_loop,
1010
)
1111

@@ -74,7 +74,7 @@ def simple_client_callback(
7474
you'll get a message back.
7575
"""
7676
initial_messages = [
77-
DirectMessageParams(
77+
IntersectDirectMessageParams(
7878
destination='hello-organization.hello-facility.hello-system.hello-subsystem.hello-service',
7979
operation='HelloExample.say_hello_to_name',
8080
payload='hello_client',

examples/1_hello_world_amqp/hello_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
from intersect_sdk import (
44
INTERSECT_JSON_VALUE,
5-
DirectMessageParams,
65
IntersectClient,
76
IntersectClientCallback,
87
IntersectClientConfig,
8+
IntersectDirectMessageParams,
99
default_intersect_lifecycle_loop,
1010
)
1111

@@ -76,7 +76,7 @@ def simple_client_callback(
7676
you'll get a message back.
7777
"""
7878
initial_messages = [
79-
DirectMessageParams(
79+
IntersectDirectMessageParams(
8080
destination='hello-organization.hello-facility.hello-system.hello-subsystem.hello-service',
8181
operation='HelloExample.say_hello_to_name',
8282
payload='hello_client',

examples/1_hello_world_events/hello_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
from intersect_sdk import (
44
INTERSECT_JSON_VALUE,
5-
DirectMessageParams,
65
IntersectClient,
76
IntersectClientCallback,
87
IntersectClientConfig,
8+
IntersectDirectMessageParams,
99
default_intersect_lifecycle_loop,
1010
)
1111

@@ -95,7 +95,7 @@ def simple_event_callback(
9595
you'll get a message back.
9696
"""
9797
initial_messages = [
98-
DirectMessageParams(
98+
IntersectDirectMessageParams(
9999
destination='hello-organization.hello-facility.hello-system.hello-subsystem.hello-service',
100100
operation='HelloExample.say_hello_to_name',
101101
payload='hello_client',

examples/2_counting/counting_client.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
from intersect_sdk import (
66
INTERSECT_JSON_VALUE,
7-
DirectMessageParams,
87
IntersectClient,
98
IntersectClientCallback,
109
IntersectClientConfig,
10+
IntersectDirectMessageParams,
1111
default_intersect_lifecycle_loop,
1212
)
1313

@@ -38,7 +38,7 @@ def __init__(self) -> None:
3838
self.message_stack = [
3939
# wait 5 seconds before stopping the counter. "Count" in response will be approx. 6
4040
(
41-
DirectMessageParams(
41+
IntersectDirectMessageParams(
4242
destination='counting-organization.counting-facility.counting-system.counting-subsystem.counting-service',
4343
operation='CountingExample.stop_count',
4444
payload=None,
@@ -47,7 +47,7 @@ def __init__(self) -> None:
4747
),
4848
# start the counter up again - it will not be 0 at this point! "Count" in response will be approx. 7
4949
(
50-
DirectMessageParams(
50+
IntersectDirectMessageParams(
5151
destination='counting-organization.counting-facility.counting-system.counting-subsystem.counting-service',
5252
operation='CountingExample.start_count',
5353
payload=None,
@@ -56,7 +56,7 @@ def __init__(self) -> None:
5656
),
5757
# reset the counter, but have it immediately start running again. "Count" in response will be approx. 10
5858
(
59-
DirectMessageParams(
59+
IntersectDirectMessageParams(
6060
destination='counting-organization.counting-facility.counting-system.counting-subsystem.counting-service',
6161
operation='CountingExample.reset_count',
6262
payload=True,
@@ -65,7 +65,7 @@ def __init__(self) -> None:
6565
),
6666
# reset the counter, but don't have it run again. "Count" in response will be approx. 6
6767
(
68-
DirectMessageParams(
68+
IntersectDirectMessageParams(
6969
destination='counting-organization.counting-facility.counting-system.counting-subsystem.counting-service',
7070
operation='CountingExample.reset_count',
7171
payload=False,
@@ -74,7 +74,7 @@ def __init__(self) -> None:
7474
),
7575
# start the counter back up. "Count" in response will be approx. 1
7676
(
77-
DirectMessageParams(
77+
IntersectDirectMessageParams(
7878
destination='counting-organization.counting-facility.counting-system.counting-subsystem.counting-service',
7979
operation='CountingExample.start_count',
8080
payload=None,
@@ -83,7 +83,7 @@ def __init__(self) -> None:
8383
),
8484
# finally, stop the counter one last time. "Count" in response will be approx. 4
8585
(
86-
DirectMessageParams(
86+
IntersectDirectMessageParams(
8787
destination='counting-organization.counting-facility.counting-system.counting-subsystem.counting-service',
8888
operation='CountingExample.stop_count',
8989
payload=None,
@@ -158,7 +158,7 @@ def client_callback(
158158
# The counter will start after the initial message.
159159
# If the service is already active and counting, this may do nothing.
160160
initial_messages = [
161-
DirectMessageParams(
161+
IntersectDirectMessageParams(
162162
destination='counting-organization.counting-facility.counting-system.counting-subsystem.counting-service',
163163
operation='CountingExample.start_count',
164164
payload=None,

src/intersect_sdk/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
)
3838
from .shared_callback_definitions import (
3939
INTERSECT_JSON_VALUE,
40-
DirectMessageParams,
40+
IntersectDirectMessageParams,
4141
)
4242
from .version import __version__, version_info, version_string
4343

@@ -52,7 +52,7 @@
5252
'IntersectService',
5353
'IntersectClient',
5454
'IntersectClientCallback',
55-
'DirectMessageParams',
55+
'IntersectDirectMessageParams',
5656
'INTERSECT_CLIENT_RESPONSE_CALLBACK_TYPE',
5757
'INTERSECT_CLIENT_EVENT_CALLBACK_TYPE',
5858
'INTERSECT_JSON_VALUE',

src/intersect_sdk/_internal/interfaces.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
INTERSECT_SERVICE_RESPONSE_CALLBACK_TYPE,
1111
)
1212
from ..shared_callback_definitions import (
13-
DirectMessageParams,
13+
IntersectDirectMessageParams,
1414
)
1515

1616

@@ -34,7 +34,7 @@ def _on_observe_event(self, event_name: str, event_value: Any, operation: str) -
3434
@abstractmethod
3535
def create_external_request(
3636
self,
37-
request: DirectMessageParams,
37+
request: IntersectDirectMessageParams,
3838
response_handler: INTERSECT_SERVICE_RESPONSE_CALLBACK_TYPE | None = None,
3939
) -> UUID:
4040
"""Observed entity (capabilitiy) tells observer (i.e. service) to send an external request.

src/intersect_sdk/capability/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
INTERSECT_SERVICE_RESPONSE_CALLBACK_TYPE,
1919
)
2020
from ..shared_callback_definitions import (
21-
DirectMessageParams,
21+
IntersectDirectMessageParams,
2222
)
2323

2424

@@ -131,7 +131,7 @@ def intersect_sdk_emit_event(self, event_name: str, event_value: Any) -> None:
131131
@final
132132
def intersect_sdk_call_service(
133133
self,
134-
request: DirectMessageParams,
134+
request: IntersectDirectMessageParams,
135135
response_handler: INTERSECT_SERVICE_RESPONSE_CALLBACK_TYPE | None = None,
136136
) -> list[UUID]:
137137
"""Create an external request that we'll send to a different Service.

src/intersect_sdk/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
INTERSECT_CLIENT_EVENT_CALLBACK_TYPE,
5050
INTERSECT_CLIENT_RESPONSE_CALLBACK_TYPE,
5151
)
52-
from .shared_callback_definitions import DirectMessageParams
52+
from .shared_callback_definitions import IntersectDirectMessageParams
5353

5454

5555
@final
@@ -425,7 +425,7 @@ def _handle_client_callback(self, user_value: IntersectClientCallback | None) ->
425425
for message in validated_result.messages_to_send:
426426
self._send_userspace_message(message)
427427

428-
def _send_userspace_message(self, params: DirectMessageParams) -> None:
428+
def _send_userspace_message(self, params: IntersectDirectMessageParams) -> None:
429429
"""Send a userspace message, be it an initial message from the user or from the user's callback function."""
430430
# ONE: SERIALIZE FUNCTION RESULTS
431431
# (function input should already be validated at this point)

src/intersect_sdk/client_callback_definitions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from typing_extensions import Annotated, TypeAlias, final
1010

1111
from .constants import SYSTEM_OF_SYSTEM_REGEX
12-
from .shared_callback_definitions import DirectMessageParams
12+
from .shared_callback_definitions import IntersectDirectMessageParams
1313

1414

1515
@final
@@ -19,7 +19,7 @@ class IntersectClientCallback(BaseModel):
1919
If you do not return a value of this type (or None), this will be treated as an Exception and will break the pub-sub loop.
2020
"""
2121

22-
messages_to_send: List[DirectMessageParams] = [] # noqa: FA100 (runtime annotation)
22+
messages_to_send: List[IntersectDirectMessageParams] = [] # noqa: FA100 (runtime annotation)
2323
"""
2424
Messages to send as a result of an event or a response from a Service.
2525
"""

src/intersect_sdk/service.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
)
6060
from .shared_callback_definitions import (
6161
INTERSECT_JSON_VALUE, # noqa: TCH001 (runtime-checked annotation)
62-
DirectMessageParams, # noqa: TCH001 (runtime-checked annotation)
62+
IntersectDirectMessageParams, # noqa: TCH001 (runtime-checked annotation)
6363
)
6464
from .version import version_string
6565

@@ -111,7 +111,7 @@ def __init__(
111111
self,
112112
req_id: UUID,
113113
req_name: str,
114-
request: DirectMessageParams,
114+
request: IntersectDirectMessageParams,
115115
response_handler: INTERSECT_SERVICE_RESPONSE_CALLBACK_TYPE | None = None,
116116
) -> None:
117117
"""Create an external request."""
@@ -223,13 +223,13 @@ def __init__(
223223
self._external_request_ctr = 0
224224

225225
self._startup_messages: list[
226-
tuple[DirectMessageParams, INTERSECT_SERVICE_RESPONSE_CALLBACK_TYPE | None]
226+
tuple[IntersectDirectMessageParams, INTERSECT_SERVICE_RESPONSE_CALLBACK_TYPE | None]
227227
] = []
228228
self._resend_startup_messages = True
229229
self._sent_startup_messages = False
230230

231231
self._shutdown_messages: list[
232-
tuple[DirectMessageParams, INTERSECT_SERVICE_RESPONSE_CALLBACK_TYPE | None]
232+
tuple[IntersectDirectMessageParams, INTERSECT_SERVICE_RESPONSE_CALLBACK_TYPE | None]
233233
] = []
234234

235235
self._data_plane_manager = DataPlaneManager(self._hierarchy, config.data_stores)
@@ -449,7 +449,9 @@ def get_blocked_keys(self) -> set[str]:
449449

450450
def add_startup_messages(
451451
self,
452-
messages: list[tuple[DirectMessageParams, INTERSECT_SERVICE_RESPONSE_CALLBACK_TYPE | None]],
452+
messages: list[
453+
tuple[IntersectDirectMessageParams, INTERSECT_SERVICE_RESPONSE_CALLBACK_TYPE | None]
454+
],
453455
) -> None:
454456
"""Add request messages to send out to various microservices when this service starts.
455457
@@ -461,7 +463,9 @@ def add_startup_messages(
461463

462464
def add_shutdown_messages(
463465
self,
464-
messages: list[tuple[DirectMessageParams, INTERSECT_SERVICE_RESPONSE_CALLBACK_TYPE | None]],
466+
messages: list[
467+
tuple[IntersectDirectMessageParams, INTERSECT_SERVICE_RESPONSE_CALLBACK_TYPE | None]
468+
],
465469
) -> None:
466470
"""Add request messages to send out to various microservices on shutdown.
467471
@@ -474,7 +478,7 @@ def add_shutdown_messages(
474478
@validate_call(config=ConfigDict(revalidate_instances='always'))
475479
def create_external_request(
476480
self,
477-
request: DirectMessageParams,
481+
request: IntersectDirectMessageParams,
478482
response_handler: Union[INTERSECT_SERVICE_RESPONSE_CALLBACK_TYPE, None] = None, # noqa: UP007 (runtime checked annotation)
479483
) -> UUID:
480484
"""Create an external request that we'll send to a different Service.
@@ -715,7 +719,7 @@ def _handle_client_message(self, message: UserspaceMessage) -> None:
715719
error_msg = f'No external request found for message:\n{message}'
716720
logger.warning(error_msg)
717721

718-
def _send_client_message(self, request_id: UUID, params: DirectMessageParams) -> bool:
722+
def _send_client_message(self, request_id: UUID, params: IntersectDirectMessageParams) -> bool:
719723
"""Send a userspace message."""
720724
# "params" should already be validated at this stage.
721725
request = GENERIC_MESSAGE_SERIALIZER.dump_json(params.payload, warnings=False)

src/intersect_sdk/shared_callback_definitions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"""
2525

2626

27-
class DirectMessageParams(BaseModel):
27+
class IntersectDirectMessageParams(BaseModel):
2828
"""These are the public-facing properties of a message which can be sent to another Service.
2929
3030
This object can be used by Clients, and by Services if initiating a service-to-service request.

tests/unit/test_base_capability_implementation.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
import pytest
77
from intersect_sdk import (
88
INTERSECT_SERVICE_RESPONSE_CALLBACK_TYPE,
9-
DirectMessageParams,
109
IntersectBaseCapabilityImplementation,
10+
IntersectDirectMessageParams,
1111
IntersectEventDefinition,
1212
intersect_event,
1313
intersect_message,
@@ -23,15 +23,15 @@ def __init__(self) -> None:
2323
self.tracked_events: list[tuple[str, Any, str]] = []
2424
self.registered_requests: dict[
2525
UUID,
26-
tuple[DirectMessageParams, INTERSECT_SERVICE_RESPONSE_CALLBACK_TYPE | None],
26+
tuple[IntersectDirectMessageParams, INTERSECT_SERVICE_RESPONSE_CALLBACK_TYPE | None],
2727
] = {}
2828

2929
def _on_observe_event(self, event_name: str, event_value: Any, operation: str) -> None:
3030
self.tracked_events.append((event_name, event_value, operation))
3131

3232
def create_external_request(
3333
self,
34-
request: DirectMessageParams,
34+
request: IntersectDirectMessageParams,
3535
response_handler: INTERSECT_SERVICE_RESPONSE_CALLBACK_TYPE | None = None,
3636
) -> UUID:
3737
request_id = uuid4()
@@ -64,7 +64,7 @@ def intersect_sdk_emit_event(self, event_name: str, event_value: Any) -> None:
6464
class BadClass3(IntersectBaseCapabilityImplementation):
6565
def intersect_sdk_call_service(
6666
self,
67-
request: DirectMessageParams,
67+
request: IntersectDirectMessageParams,
6868
response_handler: INTERSECT_SERVICE_RESPONSE_CALLBACK_TYPE | None = None,
6969
) -> None:
7070
return super().intersect_sdk_call_service(request, response_handler)
@@ -154,7 +154,7 @@ def __init__(self) -> None:
154154
@intersect_message()
155155
def mock_request_flow(self, fake_request_value: str) -> UUID:
156156
return self.intersect_sdk_call_service(
157-
DirectMessageParams(
157+
IntersectDirectMessageParams(
158158
destination='fake.fake.fake.fake.fake',
159159
operation='Fake.fake',
160160
payload=fake_request_value,

0 commit comments

Comments
 (0)