saturnin.component.service¶
Saturnin base module for implementation of Firebird Butler Services
It extends MicroService to provide a foundation for components that listen for and process
client requests using the Firebird Butler Service Protocol (FBSP).
Constants and variables¶
Classes¶
- class saturnin.component.service.ServiceConfig(name: str)[source]¶
Bases:
ComponentConfigConfiguration for Firebird Butler Services.
This class defines settings specific to
Servicecomponents, primarily the network endpoints on which the service will listen for client connections.- Parameters:
name (str) – Default configuration section name, typically the service name.
- endpoints: ListOption¶
Service endpoint addresses
- class saturnin.component.service.Service(*args, **kwargs)[source]¶
Bases:
MicroServiceBase class for Firebird Butler Services.
This class extends
MicroServiceto implement a server component that communicates with clients using the Firebird Butler Service Protocol (FBSP) over a ZMQROUTERsocket. It handles the setup of the FBSP service protocol and expects subclasses to register specific API handlers.- Parameters:
zmq_context – ZeroMQ Context.
descriptor – Service descriptor.
peer_uid – Peer ID,
Nonemeans that newly generated UUID type 1 should be used.
- initialize(config: ServiceConfig) None[source]¶
Verify configuration and assemble service structural parts.
- Parameters:
config (ServiceConfig) – Service configuration.
- Return type:
None
- abstractmethod register_api_handlers(service: FBSPService) None[source]¶
Called by
initialize()to allow subclasses to register their specific API handlers and FBSP service event handlers.Implementations of this method should use the provided
serviceprotocol instance to register handlers for various FBSP message types and API calls defined by the service.- Parameters:
service (FBSPService) – The
FBSPServiceprotocol instance associated with this service’s main communication channel.- Return type:
None
- start_activities() None[source]¶
Starts normal service activities.
This typically involves enabling the service to accept incoming client requests on its main channel. Must raise an exception if starting activities fails.
- Return type:
None
- stop_activities() None[source]¶
Stop service activities.
Calls
FBSPService.closeand disables receiving incoming messages on the channel.- Return type:
None
- svc_channel: RouterChannel¶
Channel for communication with service clients.