saturnin.component.client

Saturnin base module for implementation of Firebird Butler Service clients

Classes

class saturnin.component.client.Token(value: int = 0)[source]

Bases: object

FBSP message token generator.

Parameters:

value (int) –

next() bytes[source]

Returns next message token.

Return type:

bytes

class saturnin.component.client.ServiceClient(timeout: int = 1000)[source]

Bases: object

Base class for Firebird Butler Service clients.

Parameters:

timeout (int) –

__init__(timeout: int = 1000)[source]
Parameters:

timeout (int) – The timeout (in milliseconds) to wait for message.

close() None[source]

Close connection to service.

Return type:

None

open(channel: Channel, address: ZMQAddress, agent: AgentDescriptor, peer_uid: UUID) None[source]

Open connection to Firebird Butler service.

Parameters:
  • channel (Channel) – Channel used for communication with service.

  • address (ZMQAddress) – Service endpoint address.

  • agent (AgentDescriptor) – Client agent identification.

  • peer_uid (UUID) – Client peer ID.

Return type:

None

receive() FBSPMessage[source]

Receive one message from service.

Raises:
  • TimeoutError – When timeout expires.

  • Error – When Channel.receive() returns INVALID sentinel, or service closes connection with CLOSE message.

Return type:

FBSPMessage

send(msg: FBSPMessage) None[source]

Send message to the service.

Parameters:

msg (FBSPMessage) – Message to be sent.

Return type:

None

property connected: bool

True if client is connected to service.