nuropb.nuropb_api
Factory functions for instantiating nuropb api’s.
Module Contents
Classes
A generic service class that can be used to create a connection only service instance for the nuropb service mesh. This class could also be used as a template or to define a subclass for creating a service instance. |
Functions
Create a client api instance for the nuropb service mesh. This caller of this function will have to implement the asyncio call to connect to the service mesh: await client_api.connect() |
|
Create a client api instance for the nuropb service mesh. This caller of this function will have to implement the asyncio call to connect to the service mesh: await client_api.connect() |
Data
API
- nuropb.nuropb_api.logger
None
- nuropb.nuropb_api.default_connection_properties(connection_properties: Dict[str, Any]) Dict[str, Any]
- nuropb.nuropb_api.create_client(name: Optional[str] = None, instance_id: Optional[str] = None, connection_properties: Optional[Dict[str, Any]] = None, transport_settings: Optional[str | Dict[str, Any]] = None, transport: Optional[nuropb.rmq_api.RMQAPI] = RMQAPI) nuropb.rmq_api.RMQAPI
Create a client api instance for the nuropb service mesh. This caller of this function will have to implement the asyncio call to connect to the service mesh: await client_api.connect()
- Parameters:
name – used to identify the api connection to the service mesh
instance_id – used to create the service mesh response queue for this api connection
connection_properties – str or dict with values as required for the chosen transport api client
transport_settings – dict with values as required for the underlying transport api
transport – the class of the transport api client to use
- Returns:
- async nuropb.nuropb_api.connect(instance_id: Optional[str] = None)
- nuropb.nuropb_api.configure_mesh(mesh_name: Optional[str] = None, connection_properties: Optional[Dict[str, Any]] = None, transport_settings: Optional[str | Dict[str, Any]] = None)
- class nuropb.nuropb_api.MeshService(service_name: str, instance_id: Optional[str] = None, event_bindings: Optional[list[str]] = None, event_callback: Optional[Callable] = None)
A generic service class that can be used to create a connection only service instance for the nuropb service mesh. This class could also be used as a template or to define a subclass for creating a service instance.
Initialization
- _service_name: str
None
- _instance_id: str
None
- _event_bindings: list[str]
None
- _event_callback: Optional[Callable]
None
- async _handle_event_(topic: str, event: dict, target: list[str] | None = None, context: dict | None = None, trace_id: str | None = None)
- nuropb.nuropb_api.create_service(name: str, instance_id: Optional[str] = None, service_instance: Optional[object] = None, connection_properties: Optional[Dict[str, Any]] = None, transport_settings: Optional[str | Dict[str, Any]] = None, transport: Optional[nuropb.rmq_api.RMQAPI] = RMQAPI, event_bindings: Optional[list[str]] = None, event_callback: Optional[Callable] = None) nuropb.rmq_api.RMQAPI
Create a client api instance for the nuropb service mesh. This caller of this function will have to implement the asyncio call to connect to the service mesh: await client_api.connect()
- Parameters:
name – used to identify this service to the service mesh
instance_id – used to create the service mesh response queue for this individual api connection
service_instance – the instance of the service class that is intended to be exposed to the service mesh
connection_properties – str or dict with values as required for the chosen transport api client
transport_settings – dict with values as required for the underlying transport api
transport – the class of the transport api client to use
event_bindings – when service_instance is None, a list of event topics that this service will subscribe to. when service_instance is not None, the list will override the event_bindings of the transport_settings if any are defined.
event_callback – when service_instance is None, a callback function that will be called when an event is received
- Returns: