nuropb_gw.service_mesh_manager

Module Contents

Classes

ServiceMeshManagerController

A ServiceMeshManagerController provides the ServiceMeshManager with curated visibility to the service mesh. Only the exposed methods of the ServiceMeshManagerController are available to other service mesh services.

ServiceMeshManager

The ServiceMeshManager, is responsible for proxying communications to the service mesh and does the following:

Data

logger

HandlerType

RequestFutureResponse

RequestFutureResponse:

API

nuropb_gw.service_mesh_manager.logger

None

nuropb_gw.service_mesh_manager.HandlerType

None

nuropb_gw.service_mesh_manager.RequestFutureResponse

None

RequestFutureResponse:

  • Awaitable

  • trace_id

  • session_id

  • user_id

class nuropb_gw.service_mesh_manager.ServiceMeshManagerController(service_name: str, instance_id: str, event_topic_subscriptions: Optional[List[str]] = None)

A ServiceMeshManagerController provides the ServiceMeshManager with curated visibility to the service mesh. Only the exposed methods of the ServiceMeshManagerController are available to other service mesh services.

The ServiceMeshManagerController is not intended to interact with any handlers directly.

This is an implementation stub, and is intended to be extended by with implementation specific requirements

Initialization

_service_name: str

None

_instance_id: str

None

_event_topic_subscriptions: List[str]

None

property service_name: str
property instance_id: str
property event_topic_subscriptions: List[str]
_handle_event_(topic: str, event: Any, context: Optional[Dict[str, Any]]) None

This method is called from Service Mesh API when an event is received

Parameters:
  • topic

  • event

  • context

Returns:

Nothing

class nuropb_gw.service_mesh_manager.ServiceMeshManager(service_name: str, instance_id: str, amqp_url: str, handler_manager: nuropb_gw.handler_manager.HandlerManager, service_controller: nuropb_gw.service_mesh_manager.ServiceMeshManagerController | None = None)

The ServiceMeshManager, is responsible for proxying communications to the service mesh and does the following:

  • Manages a (NuroPb API) connection to the service mesh.

  • Passes messages between HandlerManager and the service mesh API

  • Tracks the state of asynchronous requests from handlers and directs responses from the service mesh back to the originating handler.

  • Is responsible for its and only its, connection authorisation to the service mesh transport layer and broker. NOT any on-behalf-of authorisation for handler connections.

Initialization

_service_controller: nuropb_gw.service_mesh_manager.ServiceMeshManagerController

None

_sm_api: nuropb.rmq_api.RMQAPI

None

_handler_manager: nuropb_gw.handler_manager.HandlerManager

None

property sm_api: nuropb.rmq_api.RMQAPI
property connected: bool
connect() None
disconnect() None
async handle_request(handler_response_cb, handler, payload: Dict[str, any]) None

This method is called from HandlerManager when a message is received from a handler.

Parameters:
  • handler_response_cb

  • handler

  • payload

Returns:

Nothing

async _on_handler_message_received(handler_response_cb, handler, message: Any)

This method is injected into the Handler Service Manager and called from the HandlerManager when a message is received from a handler.

The handler_response_cb is executed in the HandlerManager and has (handler, message) as arguments.

Parameters:
  • handler_response_cb

  • handler

  • message

Returns: