Archived

This forum has been archived. Please start a new discussion on GitHub.

Get all endpoint IPs Programmatically from Ice Connection

I have an ice grid locator which for example supports the following proxy group name Name@ProxyGroup. This can resolve to potential hosts
H1, H2, H3, H4

Is there a way to programmatically get H1,H2,H3,H4 from the ice connection. I ran a debugger and noted that iceProxy._locatorInfo._table._adapterEndpointsTable[0].value.endpoints[1-n]._host contains this information. However, I am not sure how to get this programmatically.

Thanks, Shiv

Comments

  • benoit
    benoit Rennes, France
    Hi,

    You can't get these endpoints directly. Instead, you would need to call on the IceGrid locator interface to retrieve the endpoints, for example:
       Ice::ObjectPrx proxy = communicator->getDefaultLocator()->findAdapterById("ProxyGroup"); 
       Ice::EndpointSeq endpoints = proxy->ice_getEndpoints();
    

    Then, you can go through the stringified endpoints and extract the host information.

    Note that the IceGrid locator might not necessarily return all the endpoints of the replica group, how many endpoints are returned depends on the n-replicas configuration of your replica group, see here for more information on this attribute.

    I'm curious as to why you need to get the IP address of each replicas. Is this to invoke on each replica individually? In this case, it might be better to use the findAllReplicas method of the IceGrid::Query interface to retrieve the proxies of each replica for a given replicated proxy.

    Cheers,
    Benoit.
  • Sorry for the late reply. I missed that you had asked a question in the response to me.

    Your suggestion works well. The reason we are considering each endpoint individually is so that we can have more control in scenarios where an endpoint might degrade in performance but not degrade to the extent that the ice grid will decommision an endpoint.