public void Connect_transceivers_operationhost() { var cre = PubnubCredentials.LoadFrom("pubnub credentials.txt"); var configServer = new FlowRuntimeConfiguration() .AddFunc <string, string>("greeting", s => s + "x") .AddStream(".@greeting", "greeting") .AddStream("greeting", ".@greeting"); using (var server = new FlowRuntime(configServer)) using (var serverhost = new PubnubOperationHost(server, cre, "thehost")) { server.Message += Console.WriteLine; var config = new FlowRuntimeConfiguration() .AddOperation(new PubnubStandInOperation("op", cre, "thehost")) .AddStream(".in", "op#greeting") .AddStream("op#greeting", ".out"); using (var fr = new FlowRuntime(config)) { fr.Message += Console.WriteLine; fr.Process(".in", "hello"); var result = ""; Assert.IsTrue(fr.WaitForResult(5000, _ => result = _.Data as string)); Assert.AreEqual("hellox", result); } } }
public void Connect_transceivers_operationhost() { var cre = PubnubCredentials.LoadFrom("pubnub credentials.txt"); var configServer = new FlowRuntimeConfiguration() .AddFunc<string, string>("greeting", s => s + "x") .AddStream(".@greeting", "greeting") .AddStream("greeting", ".@greeting"); using (var server = new FlowRuntime(configServer)) using (var serverhost = new PubnubOperationHost(server, cre, "thehost")) { server.Message += Console.WriteLine; var config = new FlowRuntimeConfiguration() .AddOperation(new PubnubStandInOperation("op", cre, "thehost")) .AddStream(".in", "op#greeting") .AddStream("op#greeting", ".out"); using (var fr = new FlowRuntime(config)) { fr.Message += Console.WriteLine; fr.Process(".in", "hello"); var result = ""; Assert.IsTrue(fr.WaitForResult(5000, _ => result = _.Data as string)); Assert.AreEqual("hellox", result); } } }