public void OnChange(NativeClient.IFabricServiceManagementClient source, Int64 handlerId, NativeClient.IFabricResolvedServicePartitionResult partition, int error) { ReleaseAssert.AssertIfNot( object.ReferenceEquals(source, this.client.NativePropertyClient), "object.ReferenceEquals(source, this.client.NativePropertyClient)"); ServicePartitionResolutionChange args = ServicePartitionResolutionChange.FromNative(partition, error); this.callback(this.client, handlerId, args); }
private void PartitionResolutionChange(FabricClient source, long handlerId, ServicePartitionResolutionChange args) { if (args.HasException) return; var ac = FabricRuntime.GetActivationContext(); var node = FabricRuntime.GetNodeContext(); var sb = new StringBuilder($"{this.ServiceInitializationParameters.ServiceName}@{node.NodeName} PartitionResolutionChange"); var i = 0; foreach (var endpoint in args.Result.Endpoints) { sb.AppendFormat($" {++i} {endpoint.Role} "); var json = JObject.Parse(endpoint.Address); var endpoints = (JObject)json["Endpoints"]; foreach (var ep in endpoints) sb.Append($"{ep.Key}:{ep.Value} "); } eventSource.Message(sb.ToString()); }