tethys.core.transports.transport_zero
¶
Module Contents¶
-
class
tethys.core.transports.transport_zero.
ZeroTransport
(connector: Union['ConnectorBase', Callable] = LocalConnector(), connections_factory: Callable = None, serializer: Callable = None, deserializer: Callable = None, **kwargs)[source]¶ Bases:
tethys.core.regobjs.regobj_zero.ZeroRegistrableObject
,tethys.core.transports.transport_base.TransportBase
The Transport entity class of the Zero generation. The ZeroTransport is an entity that defines the connection interface.
- Parameters
connector (Union[ConnectorBase, Callable]) – Connector instance that creates a connection to the data exchange system (e.g. queues broker).
connections_factory (Callable) – Factory method for the connection interfaces.
serializer (Callable) – Serialization function
deserializer (Callable) – Deserialization function
-
CLASS_PATH
= /transports/[source]¶ ZeroTransport
instances collection path in the repository
-
FIELDS_SCHEMA
[source]¶ ZeroTransport
fields validators
-
is_connected
(self, stream: ZeroStream, **kwargs) → bool[source]¶ Is the connection established
- Parameters
stream (StreamBase) – Stream for the connection
- Return type
-
connect
(self, stream: ZeroStream, **kwargs) → ConnectionBase[source]¶ Establish the connection
- Parameters
stream (StreamBase) – Stream for the connection
-
disconnect
(self, stream: ZeroStream, **kwargs)[source]¶ Disconnect the stream’s connection
- Parameters
stream (StreamBase) – Stream for the connection
-
recv
(self, stream: ZeroStream, wait_timeout: float = None, **kwargs) → Union[Tuple[str, Any], None][source]¶ Read data_packet from the stream (using connection)
- Parameters
stream (StreamBase) – Stream for the connection
wait_timeout (float) – waiting time (seconds)
-
send
(self, stream: ZeroStream, data_packet: Any, **kwargs)[source]¶ Send data_packet to the stream (using connection)
- Parameters
stream (StreamBase) – Stream for the connection
data_packet – any data object
-
ack
(self, stream: ZeroStream, message_key: str, **kwargs)[source]¶ Acknowledge message
- Parameters
stream (StreamBase) – Stream for the connection
message_key (str) – message key for the acknowledgement