Home Help Center

Dynamic Monitoring use AdminSession::setObservers

myermyer Member myer zhOrganization: www.xjgc.comProject: HVDC Scada
I want to monitor relevant state changes of IceGrid, here is some code snippets :
class NodeObserverI : virtual public ::IceGrid::NodeObserver
{
......
}
in main.cpp:

Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("PanEvent");
IceGrid::NodeObserverPtr obs1 = new NodeObserverI();
IceGrid::NodeObserverPrx prx1 = IceGrid::NodeObserverPrx::uncheckedCast(adapter->addWithUUID(obs1));
......
IceGrid::RegistryPrx reg = IceGrid::RegistryPrx::checkedCast(communicator()->stringToProxy("PANS/Registry"));
IceGrid::AdminSessionPrx as = reg->createAdminSession("fire", "");
as->setObservers(prx5, prx1, prx2, prx3, prx4);
SessionKeeperPtr sessionKeeper = new SessionKeeper(as);
sessionKeeper->start();
communicator()->waitForShutdown();

But when state changes about IceGrid registry appear, there are no notification any all.

thanks for any help.

Comments

  • bernardbernard Jupiter, FLAdministrators, ZeroC Staff Bernard NormierOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi Myer,

    Could you update the Project entry in your profile? 'none' is not a valid project.

    If you register a node observer, you'll get called when an IceGrid node goes up or down, or the state of a server managed by IceGrid changes (e.g. this server starts up).

    What kind of event are you interested in?

    Cheers,
    Bernard
  • myermyer Member myer zhOrganization: www.xjgc.comProject: HVDC Scada
    thank you.
    I'm working for a scada system, considering using IceGrid for service managing. Now only for a test, the client must know the state changes such as node-up or service-shutdown... but nothing happens when state change.

    here is the simple demo.
    winxp sp2 + vc2008 + Ice3.3 .
    thanks again.
  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi,

    Could you trying adding the following property to your IceGrid registry configuration file:
    IceGrid.Registry.Trace.Subscriber=2
    

    and restart it?

    The IceGrid registry should trace observer subscription errors with this property enabled. Note that starting the IceGrid registry with this property will emit a warning, you can ignore this warning (it's a bug that will be fixed in the next release).

    Cheers,
    Benoit.
  • myermyer Member myer zhOrganization: www.xjgc.comProject: HVDC Scada
    OK, when I don't use replica-group, it works.

    cheers,
Sign In or Register to comment.