[docs]classLocalClient(LocalCommunicator):""" This communicator implements the communication between agents via a central process broker. Note: The broker is implemented as singleton this means that all agents must be in the same process! """config:LocalSubscriptionCommunicatorConfigbroker:LocalBroker
[docs]defsetup_broker(self):"""Use the LocalBroker"""returnLocalBroker()
@propertydefsubscriptions(self):returnself.config.subscriptionsdef_send(self,payload:CommunicationDict):ifself.config.parse_json:self.broker.send(agent_id=payload["source"],message=self.to_json(payload))else:# we have to create the AgentVariable new here, because we modified the# source, and don't want to modify the original variablepayload["name"]=payload["alias"]self.broker.send(agent_id=payload["source"],message=AgentVariable(**payload))