public static async Task <PairedAgents> CreateTwoWalletsPairedWithRoutingAsync() { var handler1 = new InProcMessageHandler(); var handler2 = new InProcMessageHandler(); var handler3 = new InProcMessageHandler(); var agent1 = CreateMediator(handler1); var agent2 = CreateEdge(handler2); var agent3 = CreateEdge(handler3); handler1.TargetAgent = agent2; handler2.TargetAgent = agent1; handler3.TargetAgent = agent1; await agent1.InitializeAsync(); await agent2.InitializeAsync(); await agent3.InitializeAsync(); var result = new PairedAgents { Agent1 = agent1, Agent2 = agent2, Agent3 = agent3 }; return(result); }
public static async Task <PairedAgents> CreatePairedAsync(bool establishConnection) { var handler1 = new InProcMessageHandler(); var handler2 = new InProcMessageHandler(); var agent1 = Create(handler1); var agent2 = Create(handler2); handler1.TargetAgent = agent2; handler2.TargetAgent = agent1; await agent1.InitializeAsync(); await agent2.InitializeAsync(); var result = new PairedAgents { Agent1 = agent1, Agent2 = agent2 }; if (establishConnection) { (result.Connection1, result.Connection2) = await ConnectAsync(agent1, agent2); } return(result); }
public static async Task <PairedAgents> CreatePairedWithRoutingAsync(Dictionary <string, string> metaData = null) { var handler1 = new InProcMessageHandler(); var handler2 = new InProcMessageHandler(); var agent1 = CreateMediator(handler1); var agent2 = CreateEdge(handler2, metaData); handler1.TargetAgent = agent2; handler2.TargetAgent = agent1; await agent1.InitializeAsync(); await agent2.InitializeAsync(); var result = new PairedAgents { Agent1 = agent1, Agent2 = agent2 }; return(result); }