1

A colleague of mine has the following working against SDK 1.7:

foreach (RoleInstance ri in RoleEnvironment.CurrentRoleInstance.Role.Instances)
{
    config.discovery.zen.ping.unicast.hosts.Add(ri.InstanceEndpoints["Endpoint1"].IPEndpoint.Address.ToString());
}

When I execute the same against SDK 1.8 (osFamily=3), I notice that the InstanceEndpoints are not available by name for remote instances. The following variation, however, can still be used to determine the IP of the other instances:

foreach (RoleInstance instance in RoleEnvironment.CurrentRoleInstance.Role.Instances)
{
    if (!instance.InstanceEndpoints.ContainsKey("Endpoint1"))
       log.Error(string.Format("Instance {0} does not have Endpoint1 defined, has {1} endpoints in total.", instance.Id, instance.InstanceEndpoints.Count));

    if (instance.InstanceEndpoints.Count > 0)
       config.discovery.zen.ping.unicast.hosts.Add(instance.InstanceEndpoints[instance.InstanceEndpoints.Keys.First()].IPEndpoint.Address.ToString());
}

I can't find any documentation that speaks to this behaviour and was hoping someone could explain it?

4

0 回答 0