|
|
|
|||||
|
IcePack server registration madness
Hi there!
I've been struggling with the IcePack manual server registration for two days now and I'm no longer sure if this is due to incompetence (most likely) - documentation on that issue is, errr, challenging, to say the least. So, here's the problem. I want do do indirect binding between a client and a collection of similar objects distributed in a network. The server registers with Code:
LoadFetcher* theFetcher=new LoadFetcher();
IceUtil::ThreadControl tc=theFetcher->start();
Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("AgentAdapter");
Ice::ObjectPtr object = new AgentI(*theFetcher);
Ice::ObjectPrx objPrx = adapter->add(object, Ice::stringToIdentity(IceUtil::generateUUID()));
IcePack::AdminPrx admin = IcePack::AdminPrx::checkedCast(communicator()->stringToProxy("IcePack/Admin"));
admin->addObjectWithType(objPrx, object->ice_id());
cout << "Press Ctrl-C to terminate." << endl;
adapter->activate();
Code:
ic = Ice::initializeWithProperties(argc, argv, properties);
Ice::ObjectPrx base = ic->stringToProxy(argv[1]);
CpuMonitor::AgentPrx agent = CpuMonitor::AgentPrx::checkedCast(base);
cout << "CPU Load for agent is " << agent->fetchCpuLoad() << endl;
bash$ direct-client 10A5509D-819D-4371-970D-C01105D5284D Contacting CPU Load server... [ Location: retrieved endpoints from locator, adding to locator table adapter = endpoints = tcp -h 192.168.1.1 -p 12000 ] [ Location: retrieved endpoints from locator, adding to locator table adapter = AgentAdapter endpoints = tcp -h 192.168.1.1 -p 9593 ] CPU Load for agent is 0.99 bash$ But when I register a second server, the whole machinery seems to get out of sync. Ignoring which of the two IDs I use as direct-client argument, the output is either the load of the second server or the following: Contacting CPU Load server... [ Location: retrieved endpoints from locator, adding to locator table adapter = endpoints = tcp -h 192.168.1.1 -p 12000 ] [ Location: retrieved endpoints from locator, adding to locator table adapter = AgentAdapter endpoints = tcp -h 192.168.1.1 -p 9593 ] Outgoing.cpp:348: Ice::ObjectNotExistException: object does not exist identity: 280E2AA5-96C6-4C81-948A-7AC679B50CBF facet: operation: ice_isA Do it another one, two or three times and you're back at the second server's load, just as if IcePack has a bookkeeping problem ?! Anyone an idea? Cheers, Mobi. |
|
|||||
|
Quote:
Mobi.
__________________
Dr. Stefan Müller-Wilken Senior Manager Resco GmbH Author of 'Verteilte Internet-Anwendungen mit Ice', iX 07/2005 Author of 'Webbasierte Anwendungen mit IcePHP', iX, 06/2006 |
|
||||||
|
I suspect that you have configured the adapter of each server to use the same adapter id (which is configured with the <adapter name>.AdapterId property). Each adapter should have a distinct adapter id. If that's not the problem, we would need to know a bit more about what you're trying to do and the configuration of your client and servers.
Benoit. |
|
|||||
|
Quote:
thanks for your reply. The point is that I actually don't actively distribute using IcePack but rather register existing Ice objects in a more traditional naming service registration approach. The approach should be visible in the code snippet: Server side: ------------ - create the object adapter - initialize the object adapter - connect to icepackregistry admin interface - register object proxy with type Client side: ---------- - fetch object identitiy [ done manually using icepackadmin ] - cast object identity to object reference - call object In the 'real' client, I connect to the icepackregistry query interface, fetch a sequence of all references with appropriate type and iterate over each of them. But as the problem is visible with the minimalistic approach, I sticked to it for the sake of simplicity. ;-) Does that give you an idea of what I'm trying to do? Cheers, Mobi.
__________________
Dr. Stefan Müller-Wilken Senior Manager Resco GmbH Author of 'Verteilte Internet-Anwendungen mit Ice', iX 07/2005 Author of 'Webbasierte Anwendungen mit IcePHP', iX, 06/2006 |
|
|||||
|
Quote:
Mobi.
__________________
Dr. Stefan Müller-Wilken Senior Manager Resco GmbH Author of 'Verteilte Internet-Anwendungen mit Ice', iX 07/2005 Author of 'Webbasierte Anwendungen mit IcePHP', iX, 06/2006 |
|
||||||
|
The proxy that you register with the registry is "indirect" (see the IcePack chapter in the manual for more information on direct and indirect binding). It looks like the following:
"10A5509D-819D-4371-970D-C01105D5284D @ AgentAdapter" So when your client invokes on the identity-only proxy, the locator returns the proxy "10A5509D-819D-4371-970D-C01105D5284D @ AgentAdapter" to your client, and your client query the locator again to get the endoints of the adapter "AgentAdapter". And in your case, this returns the endpoints of the last activated "AgentAdapter" adapter. You need to set different adapter ids for each object adapter. Or, you might actually not need to set it at all if you only want to use the locator to resolve this given object (if you don't set the adapter id you will register a "direct proxy" that contains the endpoints of the adapter). Benoit. |
|
|||||
|
Quote:
So, the "@ AgentAdapter" part is caused by the AdapterId property and not by the object adapter creation parameter? I had thought so. Cheers, Mobi.
__________________
Dr. Stefan Müller-Wilken Senior Manager Resco GmbH Author of 'Verteilte Internet-Anwendungen mit Ice', iX 07/2005 Author of 'Webbasierte Anwendungen mit IcePHP', iX, 06/2006 |
|
||||||
|
Correct. The object adapter creation parameter is the name of the adapter and the adapter id of the object adapter is configured with the property <adapter name>.AdapterId.
Benoit. |
|
|||||
|
Okay, thanks for the clarification.
Cheers, Mobi. PS: By the way, have you noticed the typo on your web site? You've announced the november issue with date of '10-03-2005' which would have been a little early... ;-)
__________________
Dr. Stefan Müller-Wilken Senior Manager Resco GmbH Author of 'Verteilte Internet-Anwendungen mit Ice', iX 07/2005 Author of 'Webbasierte Anwendungen mit IcePHP', iX, 06/2006 |
|
||||||
|
Quote:
|
|
|||||
|
Quote:
Cheers, Mobi.
__________________
Dr. Stefan Müller-Wilken Senior Manager Resco GmbH Author of 'Verteilte Internet-Anwendungen mit Ice', iX 07/2005 Author of 'Webbasierte Anwendungen mit IcePHP', iX, 06/2006 |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Server Registration with IceGrid | pradeep | Help Center | 1 | 11-21-2006 10:12 AM |
| Can IcePack Service and server run in different hosts? | eyexercise | Help Center | 11 | 12-19-2004 09:41 PM |
| How to register Ice server with IcePack RegistryH | rc_hz | Help Center | 9 | 11-15-2004 08:30 AM |
| IcePack Registration notification | brian | Help Center | 4 | 10-14-2004 03:28 AM |
| libpath failure for icepack server type java-icebox | Tim | Bug Reports | 2 | 06-30-2004 05:40 PM |