Archived
This forum has been archived. Please start a new discussion on GitHub.
how to use multi objectadapters?
in Help Center
hi, there,
Suppose that we have to use two objectAdapters without icepack involved:
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("Hello");
Ice::ObjectPtr object = new HelloI;
adapter->add(object, Ice::stringToIdentity("hello"));
Ice::ObjectAdapterPtr adapter2 = communicator->createObjectAdapter("HelloHello");
object = new HelloI;
adapter2->add(object, Ice::stringToIdentity("hello"));
And in client, I want to visist the hello servant of HelloHello , I don't know how to modify the config file.
Here is my draft but doesn't work:
# client
Hello.Proxy=hello@HelloHello:tcp -p 10000
#Server
Hello.Endpoints=tcp -p 10000
HelloHello.Endpoints=tcp -p 10000
thanks in advance
fan
Suppose that we have to use two objectAdapters without icepack involved:
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("Hello");
Ice::ObjectPtr object = new HelloI;
adapter->add(object, Ice::stringToIdentity("hello"));
Ice::ObjectAdapterPtr adapter2 = communicator->createObjectAdapter("HelloHello");
object = new HelloI;
adapter2->add(object, Ice::stringToIdentity("hello"));
And in client, I want to visist the hello servant of HelloHello , I don't know how to modify the config file.
Here is my draft but doesn't work:
# client
Hello.Proxy=hello@HelloHello:tcp -p 10000
#Server
Hello.Endpoints=tcp -p 10000
HelloHello.Endpoints=tcp -p 10000
thanks in advance
fan
0
Comments
-
You have told the two object adapters to use the same endpoint. This cannot work. If you choose a different port, then it can work. Also, do you really mean to use the same object id on the second object adapter?
Anyway, why do you want to do this? In a typical application this is not necessary.
Regards, Matthew0 -
thank your quick reply.
I do this just to clarify some concepts about ice .
I have changed the port to 10001 but still not work.
.\Reference.cpp:1103: Ice::NoEndpointException:
no suitable endpoint available for proxy `hello -t @ HelloHello:tcp'Also, do you really mean to use the same object id on the second object adapter?0 -
Object identities must be unique, even across object adapters. So do not use the identity "hello" twice. Also, there is no proxy form "identity@adapter:endpoints...". If you do not use a locator, then use "identity:endpoints...". If you use a locator, then use "identity@adapter".0
-
You should do:
# client
Hello.Proxy=hello:tcp -p 10000
Hello.Proxy2=hello2:tcp -p 10001
#Server
Hello.Endpoints=tcp -p 10000
HelloHello.Endpoints=tcp -p 10001
Regards, Matthew0 -
OK.Thank you two.
1) If the document D1.Proxies can be a little clearer, we readers may feel happier.
2) That's to say, the ASM is not the private stuff of ObjectAdapter since the object identities should be unique
even across adapters?0 -
The ASM is private to object adapters, but this is simply an implementation technicality. Ice object identities still have to be unique, even if the Ice core does not detect non-unique identities being used with different ASMs.
I think the Ice manual is already very clear about this. From page 11:
"Each Ice object has a unique object identity. An object’s identity is an identifying value that distinguishes the object from all other objects. The Ice object model assumes that object identities are globally unique, that is, no two objects within an Ice communication domain can have the same object identity."0