public void sendMessage(Message message) { sentMessages.add(message); logger.info("Sending message " + message.getContent()); String receiver = message.getTo(); Agent agentTo = agents.get(receiver); if (agentTo != null) { agentTo.receive(message); } else { logger.info( "Could not deliver message <" + message.getContent() + " to unknown agent " + receiver); } }
public void disconnectAgent(Agent agent) { logger.info("Disconnecting " + agent.agentName()); agents.remove(agent); }
public void connectAgent(String name, Agent agent) { logger.info("Connecting " + agent.agentName()); agents.put(name, agent); }