aea.connections.stub.connection

This module contains the stub connection.

lock_file

@contextmanager
lock_file(file_descriptor: IO[bytes])

Lock file in context manager.

Arguments:

  • file_descriptor: file descriptio of file to lock.

read_envelopes

read_envelopes(file_pointer: IO[bytes]) -> List[Envelope]

Receive new envelopes, if any.

write_envelope

write_envelope(envelope: Envelope, file_pointer: IO[bytes]) -> None

Write envelope to file.

__init__

 | __init__(input_file_path: Union[str, Path], output_file_path: Union[str, Path], **kwargs)

Initialize a stub connection.

Arguments:

  • input_file_path: the input file for the incoming messages.
  • output_file_path: the output file for the outgoing messages.

read_envelopes

 | read_envelopes() -> None

Receive new envelopes, if any.

receive

 | async receive(*args, **kwargs) -> Optional["Envelope"]

Receive an envelope.

connect

 | async connect() -> None

Set up the connection.

disconnect

 | async disconnect() -> None

Disconnect from the channel.

In this type of connection there's no channel to disconnect.

send

 | async send(envelope: Envelope)

Send messages.

Returns:

None

from_config

 | @classmethod
 | from_config(cls, address: Address, configuration: ConnectionConfig) -> "Connection"

Get the stub connection from the connection configuration.

Arguments:

  • address: the address of the agent.
  • configuration: the connection configuration object.

Returns:

the connection object