Archived

This forum has been archived. Please start a new discussion on GitHub.

Problem with IceStorm

I've set up an IceStorm service and run it with network trace set to 2. I start my service, it connects okay, I start up a "listener" client, connects okay, then I run a client that makes calls on the service, which publishes events to the IceStorm service.

Tracing shows that IceStorm receives the events from the service just fine, but the listener doesn't seem to receive anything.

Here is the listener code:

class MSCApplication : virtual public Ice::Application
{
public:
virtual int run(int, char **)
{
//
// Set up for IceStorm.
//
Ice::ObjectPrx obj = communicator()->stringToProxy(
"MSCEventService/TopicManager:tcp -h cactus -p 9999");

IceStorm::TopicManagerPrx topicManager =
IceStorm::TopicManagerPrx::checkedCast(obj);


Ice::ObjectAdapterPtr adapter =
communicator()->createObjectAdapter("MonitorAdapter");

MSC::MonitorPtr monitor = new MonitorI;
Ice::ObjectPrx proxy = adapter->addWithUUID(monitor);

IceStorm::TopicPrx topic;
try
{
topic = topicManager->retrieve("ActuatorControl");
IceStorm::QoS qos;
topic->subscribe(qos, proxy);
}
catch (const IceStorm::NoSuchTopic&)
{
std::cerr << "No topic found" << std::endl;
}

adapter->activate();

communicator()->waitForShutdown();

return 0;
}
};

I have no idea what I am doing wrong (most likely something simple, but I'm at a lose right now). The string "ActuatorControl" is correct, and I actually have error checking code (took it out to make this shorter) that passes just fine. Seems like it should work.

Help!

Thanks,
Mark

Comments

  • mes
    mes California
    Hi Mark,

    One reason for this behavior is invalid endpoints for the listener's object adapter. For example, if the IceStorm service is running on a different host than the listener, then it's important to define an endpoint that contains the appropriate host information.

    What endpoints have you defined for MonitorAdapter?

    Take care,
    - Mark
  • I guess I thought that addWithUUID did that. I don't explicitly set up an endpoint. I just went by the example in Chapter 41, p. 1173...
  • mes
    mes California
    Mark,

    Ice allows object adapters to be created without endpoints. This is useful for example when using bidirectional connections, because a client doesn't need to establish a separate endpoint for accepting incoming connections yet still requires an object adapter in order to receive callback requests.

    If you call createObjectAdapter("MonitorAdapter"), then the object adapter will check for the presence of a configuration property named MonitorAdapter.Endpoints that defines its endpoints.

    Take care,
    - Mark
  • Okay, that did the trick. Thanks!