private async Task OnNextAsync(Tuple <string, Message> item) { try { this.TraceMessage(true, item); if (this.IsSelf(item.Item1)) { this.Incoming.OnNext(item); } else if (!this.groupConfig.Settings.IsUseHttpTransportForInstanceCommunication) { ChannelFactory <IDxStoreInstance> factory = this.GetChannelFactory(item.Item1); await Concurrency.DropContext(WCF.WithServiceAsync <IDxStoreInstance>(factory, (IDxStoreInstance instance) => instance.PaxosMessageAsync(this.groupConfig.Self, item.Item2), null, default(CancellationToken))); } else { HttpRequest.PaxosMessage msg = new HttpRequest.PaxosMessage(this.nodeEndPoints.Self, item.Item2); string targetHost = this.groupConfig.GetMemberNetworkAddress(item.Item1); await HttpClient.SendMessageAsync(targetHost, item.Item1, this.groupConfig.Name, msg); } } catch (Exception ex) { if (GroupMembersMesh.Tracer.IsTraceEnabled(TraceType.ErrorTrace)) { GroupMembersMesh.Tracer.TraceError((long)this.identity.GetHashCode(), "{0}: OnNextAsync(Node:{1}, Msg:{2}) failed with {3}", new object[] { this.identity, item.Item1, item.Item2, ex }); } } }