Archived
This forum has been archived. Please start a new discussion on GitHub.
IceStorm problems with "propertyToProxy"
delbarrioa
in Help Center
Hello,
I am trying to use IceStorm with configuration files.
I am trying to use IceStorm with configuration files.
class myClass : virtual public ::Ice::Application
{
private:
class subscriber;
class publisher;
public:
myclass()
{
theSubscriber = new subscriber();
thePublicher = new publisher();
}
}
0
Comments
-
IceStorm problems with "propertyToProxy"
I use Ice 3.3class myClass : virtual public ::Ice::Application { private: class subscriber; class publisher; public: myclass() { theSubscriber = new subscriber(); thePublicher = new publisher(); } int run (int argc, char argv[]); }
the function run is like this:int myClass::run (int argc, char argv[]) { try { ::Ice::ObjectAdapterPtr adapter; ::IceStorm::TopicPrx topic subscriber_topic; ::IceStorm::TopicPrx topic_publisher_topic; [B] [B]::Ice::ObjectPrx obj = ic->propertyToProxy("TopicManager.Proxy");[/B] [COLOR="Green"] //before I had this and it worked : [/COLOR] [COLOR="Red"]//::Ice::ObjectPrx obj = ic->stringToProxy("DemoIceStorm/TopicManager:tcp -h xxx.xxx.xxx.87 -p 10000");[/COLOR] [COLOR="Green"] // When I print the value of obj in the screen it is empty[/COLOR][/B] std::cout<<"obj = "<<obj<<std::endl; ::IceStorm::TopicManagerPrx manager = ::IceStorm::TopicManagerPrx::checkedCast(obj); if(!manager) { std::cerr << "ERROR : invalid proxy" << std::endl; } // // Retrieve the topic. // ............. // Get the topic's publisher object, and create a Clock proxy with // the mode specified as an argument of this application. // ..................... // // Add a Servant for the Ice Object. // ............................ catch(const char* err) { std::cerr<<"error: "<<err<<std::endl; return EXIT_FAILURE; } }
I use the following config file#------------------------------------------------------------------ # IceStorm Configuration Properties #------------------------------------------------------------------ IceStorm.InstanceName=DemoIceStorm # # This property defines the endpoints on which the topic # publisher objects listen. If you want to federate # IceStorm instances this must run on a fixed port (or use # IceGrid). # # # This property is used to configure the endpoints of the Audio # subscriber adapter. # Audio.Subscriber.Endpoints=tcp:udp # # This property is used by the clients to connect to IceStorm. # [B]TopicManager.Proxy=DemoIceStorm/TopicManager:tcp -h xxx.xxx.xxx.87 -p 10000[/B]
thanks for the help.0 -
Most likely you are not telling your application to load the config file. You need to either pass it on the command line using "--Ice.Config=myconfig" or in code you could pass to Application::main(). For example
myclass mc = new myclass(); myclass.main(argc, argv, "myconfig");0 -
What is ic? The Application class creates the communicator for you, which you can access via the communicator() method. Are you creating a second communicator? If that is the case then it is very unlikely that it is needed, as well as it being the cause of your issue. The config is read by the Application communicator but not by the communicator you are using.0
