Archived

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

How to register Ice server with IcePack RegistryH

I want to use IcePack Registry without IcePack Node, and this is my config file:
%more config.registry
IcePack.Registry.Client.Endpoints=default -p 12000
IcePack.Registry.Server.Endpoints=default -p 12001
IcePack.Registry.Admin.Endpoints=default -p 12002
IcePack.Registry.Data=db
IcePack.Registry.DynamicRegistration=1

First, i start the IcePack registry with the command:
%icepackregistry --Ice.Config=config.registry &

Problem:
1)When the above command is executed, more than one process have been spawned! why ?
%ps -ef | grep icepackregistry | grep -v grep
iceuser 14792 13849 2 01:25 pts/4 00:00:00 icepackregistry --Ice.Config=con
iceuser 14793 14792 0 01:25 pts/4 00:00:00 icepackregistry --Ice.Config=con
iceuser 14794 14793 0 01:25 pts/4 00:00:00 icepackregistry --Ice.Config=con
iceuser 14795 14793 0 01:25 pts/4 00:00:00 icepackregistry --Ice.Config=con
iceuser 14796 14793 0 01:25 pts/4 00:00:00 icepackregistry --Ice.Config=con
iceuser 14797 14793 0 01:25 pts/4 00:00:00 icepackregistry --Ice.Config=con
iceuser 14798 14793 0 01:25 pts/4 00:00:00 icepackregistry --Ice.Config=con
iceuser 14799 14793 0 01:25 pts/4 00:00:00 icepackregistry --Ice.Config=con
iceuser 14800 14793 0 01:25 pts/4 00:00:00 icepackregistry --Ice.Config=con
iceuser 14801 14793 0 01:25 pts/4 00:00:00 icepackregistry --Ice.Config=con
iceuser 14802 14793 0 01:25 pts/4 00:00:00 icepackregistry --Ice.Config=con

2)How I white the code to register my Ice server to the Ice registry ? I can neithor find corresponding example nor find API functions about this!

Thanks in advance!

Comments

  • You not seeing several processes, you are seeing multiple threads within the same process.

    For doc on IcePack, please see the IcePack chapter. Also, the demos in ice/demo/IcePack will help to work out how to set things up.

    Cheers,

    Michi.
  • 1) I tried again! I can affirmatively say that I am seeing processes not threads!
    iceuser localhost%uname -a
    Linux localhost.localdomain 2.4.18-3 #1 Thu Apr 18 07:37:53 EDT 2002 i686 unknown

    iceuser localhost%ps -ef | head -n 1
    UID PID PPID C STIME TTY TIME CMD

    iceuser localhost%ps -ef | grep icepackregistry | grep -v grep
    iceuser 15887 15816 3 03:41 pts/0 00:00:03 icepackregistry --Ice.Config=con
    iceuser 15888 15887 0 03:41 pts/0 00:00:00 icepackregistry --Ice.Config=con
    iceuser 15889 15888 0 03:41 pts/0 00:00:00 icepackregistry --Ice.Config=con
    iceuser 15890 15888 0 03:41 pts/0 00:00:00 icepackregistry --Ice.Config=con
    iceuser 15891 15888 0 03:41 pts/0 00:00:00 icepackregistry --Ice.Config=con
    iceuser 15892 15888 0 03:41 pts/0 00:00:00 icepackregistry --Ice.Config=con
    iceuser 15893 15888 0 03:41 pts/0 00:00:00 icepackregistry --Ice.Config=con
    iceuser 15894 15888 0 03:41 pts/0 00:00:00 icepackregistry --Ice.Config=con
    iceuser 15895 15888 0 03:41 pts/0 00:00:00 icepackregistry --Ice.Config=con
    iceuser 15896 15888 0 03:41 pts/0 00:00:00 icepackregistry --Ice.Config=con
    iceuser 15897 15888 0 03:41 pts/0 00:00:00 icepackregistry --Ice.Config=con

    2)I have learned examples in ice/demo/IcePack. But they are all relevant to the usage of IcePack Node(automatic-server- activation) and don't demostrate how to register Ice server just using IcePack Registry while not using IcePack Node.
  • These are thread, really :) The old Linux threads show up as separate processes.
  • Oh....I am wrong! They are theads!

    About the 2nd question: I want to use IcePack Registry without IcePack Node. That is, i want to register my Ice server directly to IcePack Registry and don't want to run a IcePack Node process! How? I can not find anything useful in the "demo/IcePack".
  • mes
    mes California
    Originally posted by rc_hz
    About the 2nd question: I want to use IcePack Registry without IcePack Node. That is, i want to register my Ice server directly to IcePack Registry and don't want to run a IcePack Node process! How? I can not find anything useful in the "demo/IcePack".
    Run the icepackregistry executable and define the relevant IcePack.Registry.* properties.

    - Mark
  • I am sorry to have to disturb you so many times, but i still can not get what you said! This is my test case. What's wrong with me ? Thank you very very much!

    1.In the first window, i run the icepackregistry process:
    iceuser localhost%pwd
    /home/iceuser/work/products/opensource/Ice-1.5.0/demo/IcePack/rctest/registry

    iceuser localhost%more config
    IcePack.Registry.Client.Endpoints=default -p 12000
    IcePack.Registry.Server.Endpoints=default -p 12001
    IcePack.Registry.Admin.Endpoints=default -p 12002
    IcePack.Registry.Internal.Endpoints=default -p 12003
    IcePack.Registry.Data=db

    IcePack.Registry.DynamicRegistration=1
    IcePack.Registry.Trace.ServerRegistry=1
    IcePack.Registry.Trace.AdapterRegistry=1

    Ice.PrintAdapterReady=1

    Ice.ConnectionIdleTime=0

    iceuser localhost%icepackregistry --Ice.Config=config &

    2.In the second window, i run the server process
    iceuser localhost%pwd
    /home/iceuser/work/products/opensource/Ice-1.5.0/demo/IcePack/rctest/hello

    iceuser localhost%more config
    Ice.Default.Locator=IcePack/Locator:tcp -p 12000
    Ice.PrintAdapterReady=1
    IcePack.Registry.DynamicRegistration=1

    Hello.Endpoints=tcp -p 10000:udp -p 10000

    iceuser localhost%server &
    Hello ready

    iceuser localhost%more Hello.ice
    #ifndef HELLO_ICE
    #define HELLO_ICE

    class Hello
    {
    nonmutating void sayHello();
    idempotent void shutdown();
    };

    #endif

    iceuser localhost%more Server.cpp
    #include <Ice/Ice.h>
    #include <HelloI.h>

    using namespace std;

    int
    run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
    {
    Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("Hello");
    Ice::ObjectPtr object = new HelloI;
    adapter->add(object, Ice::stringToIdentity("hello"));
    adapter->activate();
    communicator->waitForShutdown();
    return EXIT_SUCCESS;
    }

    int
    main(int argc, char* argv[])
    {
    int status;
    Ice::CommunicatorPtr communicator;

    try
    {
    Ice::PropertiesPtr properties = Ice::createProperties(argc, argv);
    properties->load("config");
    communicator = Ice::initializeWithProperties(argc, argv, properties);
    status = run(argc, argv, communicator);
    }
    catch(const Ice::Exception& ex)
    {
    cerr << ex << endl;
    status = EXIT_FAILURE;
    }

    if(communicator)
    {
    try
    {
    communicator->destroy();
    }
    catch(const Ice::Exception& ex)
    {
    cerr << ex << endl;
    status = EXIT_FAILURE;
    }
    }

    return status;
    }


    3.In the third window, i run the icepackadmin process and try the "object find TYPE" command, but i can not find anything:
    iceuser localhost%pwd
    /home/iceuser/work/products/opensource/Ice-1.5.0/demo/Ice/hello
    iceuser localhost%more config
    Ice.Default.Locator=IcePack/Locator:tcp -p 12000
    Ice.PrintAdapterReady=1
    IcePack.Registry.DynamicRegistration=1

    Hello.Endpoints=tcp -p 10000:udp -p 10000

    iceuser localhost%icepackadmin --Ice.Config=config
    Ice 1.5.0 Copyright 2003-2004 ZeroC, Inc.
    This copy of Ice is free software. You are welcome to change it and/or
    distribute copies under certain conditions. Type "show copying" to see
    these conditions.
    There is absolutely no warranty for Ice. Type "show warranty" for details.

    >>> object find ::Hello
    error: IcePack::ObjectNotExistException
    >>> exit
    iceuser localhost%
  • mes
    mes California
    An object with the identity "hello" has not been registered with the IcePack registry, therefore the registry returns IcePack::ObjectNotExistException from the query.

    In order for your query to succeed, you would need to invoke the command

    >>> object add "hello:tcp -p 10000:udp -p 10000"

    Or your server could have manually registered its object with the registry by invoking addObject on the IcePack::Admin interface.

    Take care,
    - Mark
  • Thanks, mes! You are so kindly! I know now!
  • I know now! Thanks!