Client¶
One-off scripting arrangements and user-created orchestrators are Clients. If you’re looking to register your application into INTERSECT, please see the intersect_sdk.service module.
The Client is meant to be a way to interact with specific INTERSECT Services through custom scripts. You’ll need to have knowledge of the schemas of these services when constructing your client, as this class does not make any assumptions about the services beyond how they would be managed in the SDK’s own IntersectService class.
Users do not need to interact with the client other than through its constructor and the lifecycle “start” and “stop” methods.
Most useful definitions and typings will be found in the client_callback_definitions module.
- final class intersect_sdk.client.IntersectClient(config: IntersectClientConfig, user_callback: Callable[[str, str, bool, list[INTERSECT_JSON_VALUE] | dict[str, INTERSECT_JSON_VALUE] | str | bool | int | float | None | bytes], IntersectClientCallback | None] | None = None, event_callback: Callable[[str, str, str, list[INTERSECT_JSON_VALUE] | dict[str, INTERSECT_JSON_VALUE] | str | bool | int | float | None | bytes], IntersectClientCallback | None] | None = None)¶
If you’re just wanting to connect into INTERSECT temporarily to send messages between services, use the IntersectClient class.
Note that the ONLY current stable API is: - the constructor - startup() - shutdown() - is_connected()
No other functions or parameters are guaranteed to remain stable.
NOTE: the current implementation requires you have knowledge about the schema of the service(s) you’re wanting to communicate with.
- final considered_unrecoverable() bool¶
Check if any broker is considered to be in an unrecoverable state.
- Returns:
True if we can’t recover, false otherwise
- final is_connected() bool¶
Check if we’re currently connected to the INTERSECT brokers.
- Returns:
True if we are currently connected to INTERSECT, False if not
- final shutdown(reason: str | None = None) Self¶
This function disconnects the client from INTERSECT configurations. It does NOT otherwise drop anything else from memory.
This function should generally be called immediately after the broker connection loop.
The function should only be called in your own lifecycle functions. The default INTERSECT lifecycle loop will call it once it breaks out of the main lifecycle loop.
- Params:
reason: an optional description you may provide as to why the adapter is shutting down (currently unused for client).
- final startup() Self¶
This function connects the client to all INTERSECT systems.
You will need to call this function at least once in your application’s lifecycle. You will also need to call it again if you call shutdown() on the service, and want to restart the INTERSECT connection without killing your application’s process.
This function should only be called in your own lifecycle functions. The default INTERSECT lifecycle loop will call it prior to starting the main lifecycle loop.