minos.networks.brokers.clients

Classes

BrokerClient

Broker Client class.

class BrokerClient[source]

Bases: SetupMixin

Broker Client class.

__init__(topic, publisher, subscriber, **kwargs)[source]
Parameters
async send(message)[source]

Send a BrokerMessage.

Parameters

message (BrokerMessage) – The message to be sent.

Returns

This method does not return anything.

Return type

None

async receive(*args, **kwargs)[source]

Get one handler entry from the given topics.

Parameters
  • args – Additional positional parameters to be passed to receive_many.

  • kwargs – Additional named parameters to be passed to receive_many.

Returns

A HandlerEntry instance.

Return type

BrokerMessage

async receive_many(count, timeout=60, **kwargs)[source]

Get multiple handler entries from the given topics.

Parameters
  • timeout (float) – Maximum time in seconds to wait for messages.

  • count (int) – Number of entries to be collected.

Returns

A list of HandlerEntry instances.

Return type

AsyncIterator[BrokerMessage]

property already_destroyed: bool

Already Destroy getter.

Returns

A boolean value.

property already_setup: bool

Already Setup getter.

Returns

A boolean value.

async destroy()

Destroy miscellaneous repository things.

Returns

This method does not return anything.

Return type

None

classmethod from_config(config=None, **kwargs)

Build a new instance from config.

Parameters
  • config (Optional[Union[Config, Path]]) – Config instance. If None is provided, default config is chosen.

  • kwargs – Additional named arguments.

Returns

A instance of the called class.

Return type

S

async setup()

Setup miscellaneous repository things.

Returns

This method does not return anything.

Return type

None