saturnin.component.service

Saturnin base module for implementation of Firebird Butler Services

Constants and variables

saturnin.component.service.SVC_CHN: Final[str]

Channel name

Classes

class saturnin.component.service.ServiceConfig(name: str)[source]

Bases: ComponentConfig

Base data provider/consumer microservice configuration.

Parameters:

name (str) – Default configuration section name (service name)

agent: UUIDOption

Agent identification

endpoints: ListOption

Service endpoint addresses

logging_id: StrOption

Logging ID for this component instance

class saturnin.component.service.Service(*args, **kwargs)[source]

Bases: MicroService

Base Firebird Butler Service.

__init__(zmq_context: Context, descriptor: ServiceDescriptor, *, peer_uid: UUID | None = None)[source]
Parameters:
  • zmq_context (Context) – ZeroMQ Context.

  • descriptor (ServiceDescriptor) – Service descriptor.

  • peer_uid (UUID | None) – Peer ID, None means 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

abstract register_api_handlers(service: FBSPService) None[source]

Called by initialize() for registration of service API handlers and FBSP service event handlers.

Parameters:

service (FBSPService) – Service instance

Return type:

None

start_activities() None[source]

Start normal service activities.

Must raise an exception when start fails.

Return type:

None

stop_activities() None[source]

Stop service activities.

Calls FBSPService.close and disables receiving incoming messages on the channel.

Return type:

None

descriptor: ServiceDescriptor

Service desriptor.

details: Exception | List[str]

Service execution outcome details

endpoints: Dict[str, List[ZMQAddress]]

Dictionary with endpoints to which the component binds. Key is channel name, value is list of ZMQAddress instances. Initially empty.

mngr: ChannelManager

ChannelManager instance.

outcome: Outcome

Service execution outcome

peer: PeerDescriptor

Peer descriptor for this component.

state: State

Service internal state

stop: threading.Event

Event to stop the component

svc_channel: RouterChannel

Channel for communication with service clients.