|
|
|
|||||
|
invocation between two services in the IceBox
Hi~
I have two services in the IceBox. One service try to invoke a function of another service for collocation optimization. suppose service's name is Print1 and Print2 respectively. and I set the properties in the IceBox configuration file. IceBox.UseSharedCommunicator.Print1=1 IceBox.UseSharedCommunicator.Print2=1 IceBox runs on single machine. This is my code... void demo: rint1MessageI: rint1(const Ice::Current& current){ Ice::ObjectAdapterPtr objptr = current.adapter; Ice::CommunicatorPtr ic = objptr->getCommunicator(); print2MessagePrx prx = print2MessagePrx::checkedCast(ic->stringToProxy("print2:tcp -p 9997")); /* always recieved null proxy. */ if(!prx){ std::cout << "invalid proxy..." << std::endl; return; } std::cout << "this is message from Print1..." << std::endl; prx->print2(); } Whenever I am trying to get proxy for print2, I recieved null proxy. But when I invoked print2 outside the IceBox with client I made, It works well. Do I have some mistakes in my idea? |
|
|||||
|
Thanks Metthew
I saw your code, there is much different implementations rather than I made. my properties in config.icebox IceBox.Service.Print=print1Service:create --Ice.Config=config.print1 IceBox.Service.Print2=print2Service:create --Ice.Config=config.print2 As you can see, I have made two different so files libprint1Service.so, libprint2Service.so respectively. my point is invocations between functions in separated so file under collocation optimization. This is very very important point in our project. start() function in print1ServiceI.cpp file is void print1ServiceI::start(const std::string& name, const Ice::CommunicatorPtr& communicator, const Ice::StringSeq& args) { _adapter = communicator->createObjectAdapter(name); /* name is Print1 */ _adapter->add(new demo: rint1MessageI, communicator->stringToIdentity("print1"));_adapter->activate(); } start() function in print2ServiceI file is void print2ServiceI::start(const std::string& name, const Ice::CommunicatorPtr& communicator, const Ice::StringSeq& args) { _adapter = communicator->createObjectAdapter(name); /* name is Print2 */ _adapter->add(new demo2: rint2MessageI, communicator->stringToIdentity("print2"));_adapter->activate(); } <print1I.cpp is> void demo rint1MessageI rint1(const Ice::Current& current){ Ice::ObjectAdapterPtr objptr = current.adapter; Ice::CommunicatorPtr ic = objptr->getCommunicator(); print2MessagePrx prx = print2MessagePrx::checkedCast(ic->stringToProxy("print2:tcp -p 9997")); /* always recieved null proxy. */ if(!prx){ std::cout << "invalid proxy..." << std::endl; return; } std::cout << "this is message from Print1..." << std::endl; prx->print2(); } <print2I.cpp is> void demo2: rint2MessageI: rint2(const Ice::Current& current){ std::cout << "This is message from print2..." << std::endl; } print1.ice is module demo { interface print1Message{ void print1(); }; }; print2.ice is module demo2 { interface print2Message{ void print2(); }; }; I thought services(which are contained different so file) in an IceBox have a diffrent object adapter each other, and these object adapters could share the same communicator with UseSharedCommunicator property. Am I wrong? in your start() funtion in HelloServiceI.cpp has created one object adapter and registered HelloForwardI servant and HelloI sevant on same object adapter. finally you made two service within one suppose some situations.... If I got a service from someone with binary so file and I loaded this so file in my IceBox, I'd like to invoke a function in this service with my service under collocation optimization environment. is it impossible? sorry for my poor english.. ![]() |
|
||||||
|
Quote:
Using one service DLL that is loaded twice versus loading two service DLLs should not be relevant. My example actually does create two object adapters each with a unique name (one is named Hello and the other HelloForward). The same object being registered with both also should not matter in this case. You can try this for yourself by changing the code: Code:
void
HelloServiceI::start(const string& name, const Ice::CommunicatorPtr& communicator, const Ice::StringSeq& args)
{
_adapter = communicator->createObjectAdapter(name);
if(name == "HelloForward")
{
_adapter->add(new HelloForwardI, communicator->stringToIdentity("helloforward"));
}
else
{
_adapter->add(new HelloI, communicator->stringToIdentity("hello"));
}
_adapter->activate();
}
The quickest way to sort this issue out is for you to reply with a complete, self contained compilable example that demonstrates this issue. Also can you confirm your operating system, compiler and Ice version please? Best Regards, Matthew |
![]() |
| 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 |
| Does IceBox support services implemented in python | zephyr007 | Comments | 3 | 01-23-2008 09:22 AM |
| IceBox Determining Dependent Services | Sameerrele | Help Center | 2 | 09-25-2006 01:59 PM |
| IceBox hosting java services in IceGrid | Sameerrele | Help Center | 5 | 08-21-2006 11:56 AM |
| Purify and IceBox services | xdm | Help Center | 4 | 06-07-2006 04:59 PM |
| Share endpoint between services in IceBox | rspivak | Help Center | 2 | 04-14-2006 07:18 AM |