Archived
This forum has been archived. Please start a new discussion on GitHub.
Can I Get the object's DirectProxy?
Hi,
Can I get the directproxy of a object from the icegridregistry?
I called the findallreplica and I got a list of indirect proxies. And I want the proxies with ip and port with out call to ice_getConnection(which will create a connection to server, this is not my wanner)
thanks!
Can I get the directproxy of a object from the icegridregistry?
I called the findallreplica and I got a list of indirect proxies. And I want the proxies with ip and port with out call to ice_getConnection(which will create a connection to server, this is not my wanner)
thanks!
0
Comments
-
Hi,
You need to use the Ice::Locator interface directly to resolve the endpoints of the adapter IDs of each indirect proxy.
For example:// C++ Ice::Identity myIdentity = ...; Ice::ObjectPrxSeq proxies = query->findAllReplicas(myIdentity); Ice::LocatorPrx locator = query->ice_getCommunicator()->getDefaultLocator(); Ice::ObjectPrxSeq directProxies; for(Ice::ObjectPrxSeq::const_iterator p = proxies.begin(); p != proxies.end(); ++p) { try { Ice::ObjectPrx directProxy = locator->findAdapterById((*p)->ice_getAdapterId()); directProxies.push_back((*p)->ice_endpoints(directProxy->ice_getEndpoints())); } catch(std::exception& ex) { // Handle exception } }
In the code above, the directProxies sequence will contain a list of direct proxies for each of the replicas. Note that this will cause the activation of all the replicas if necessary.
Cheers,
Benoit.0 -
thank you!0