farm-ng-core
|
Public Member Functions | |
None | __init__ (self, EventServiceConfig config) |
EventServiceConfig | config (self) |
EventServiceHealthMetrics | metrics (self) |
logging.Logger | logger (self) |
str | server_address (self) |
AsyncIterator[tuple[Event, Message|bytes]] | subscribe (self, SubscribeRequest request, bool decode=True) |
list[Uri] | list_uris (self) |
RequestReplyReply | request_reply (self, str path, Message message, list[Timestamp]|None timestamps=None) |
Public Attributes | |
channel | |
stub | |
Generic client class to connect with the Amiga brain services. Internally implements an `asyncio` gRPC channel that is designed to be imported by service specific clients.
None core.event_client.EventClient.__init__ | ( | self, | |
EventServiceConfig | config | ||
) |
Initializes the client. Args: config (EventServiceConfig): the grpc configuration data structure. Raises: ValueError: if the port or host are invalid.
EventServiceConfig core.event_client.EventClient.config | ( | self | ) |
Returns the configuration data structure.
list[Uri] core.event_client.EventClient.list_uris | ( | self | ) |
Returns the list of uris. Returns: list[Uri]: the list of uris.
logging.Logger core.event_client.EventClient.logger | ( | self | ) |
Returns the logger.
EventServiceHealthMetrics core.event_client.EventClient.metrics | ( | self | ) |
Returns the metrics data structure.
RequestReplyReply core.event_client.EventClient.request_reply | ( | self, | |
str | path, | ||
Message | message, | ||
list[Timestamp] | None | timestamps = None |
||
) |
Sends a request and waits for a reply. Args: path (str): the path of the request. message (Message): the message to send. timestamps (list[Timestamp], optional): the timestamps to add to the event. Returns: ReqRepReply: the reply.
str core.event_client.EventClient.server_address | ( | self | ) |
Returns the composed address and port.
AsyncIterator[tuple[Event, Message | bytes]] core.event_client.EventClient.subscribe | ( | self, | |
SubscribeRequest | request, | ||
bool | decode = True |
||
) |
Subscribes to the server. Args: request (SubscribeRequest): the subscription request. decode (bool, optional): if True, the payload will be decoded. Defaults to True. Yields: tuple[Event, Message | bytes]: the event and the payload.
core.event_client.EventClient.channel |
core.event_client.EventClient.stub |