Home Help Center

IcePack and Glacier2 configuration

xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
Hello

I trying to configure Glacier2 to work with a service deployed in a icepacknode, i'm not sure if this is posible. i basicaly create a chatserice similar to the example provided with Ice sources but i create it as a IceBox::Service and activate it trow IcePack instead of running as Ice::Application

how is the way to specific glacier2.server.endpoints to point a service in to icepack

must the service has a fixed endpoint in the descriptor file or can it use default option ?

Comments

  • matthewmatthew NL, CanadaMember Matthew NewhookOrganization: ZeroC, Inc.Project: Internet Communications Engine ✭✭✭
    xdm wrote:
    Hello

    I trying to configure Glacier2 to work with a service deployed in a icepacknode, i'm not sure if this is posible. i basicaly create a chatserice similar to the example provided with Ice sources but i create it as a IceBox::Service and activate it trow IcePack instead of running as Ice::Application

    how is the way to specific glacier2.server.endpoints to point a service in to icepack

    must the service has a fixed endpoint in the descriptor file or can it use default option ?

    Yes, this is possible. One the future newsletter articles will show exactly how to do this. You don't need to do anything special with respect to endpoints, and you certainly don't need to run them on a fixed endpoint.

    To turn the server into an IceBox server you take the contents of the ChatSessionServer::run method and make it into an IceBox service.

    Something like this.
    class ChatSessionServiceI : public ::IceBox::Service
    {
    public:
    
        virtual void
        start(const string& name, const CommunicatorPtr& communicator, const StringSeq& args)
        {
            _adapter = communicator->createObjectAdapter("ChatServer");
            _adapter->add(new DummyPermissionsVerifierI, Ice::stringToIdentity("verifier"));
            _adapter->add(new ChatSessionManagerI, Ice::stringToIdentity("ChatSessionManager"));
            _adapter->activate();
        }
    
        virtual void
        stop()
        {
            _adapter->deactivate();
        }
    
    private:
    
        Ice::ObjectAdapterPtr _adapter;
    };
    

    Then you need a deployment descriptor. Something like this:
    <icepack>
      <variable name="icebox.exe" value="icebox"/>
      <target name="windebug">
          <variable name="icebox.exe" value="iceboxd"/>
      </target>
      <application name="ChatServer">
         <node name="node">
            <server name="ChatApplication" kind="cpp-icebox" endpoints="tcp -h 127.0.0.1" activation="on-demand">
                <service name="ChatSession" entry="ChatSessionService:create">
                    <adapters>
                        <adapter name="ChatServer" endpoints="tcp">
                            <object identity="ChatSessionManager" type="::Chat::ChatSession"/>
                            <object identity="verifier" type="::Glacier2::PermissionsVerifier"/>
                        </adapter>
                    </adapters>
                </service>
            </server>
         </node>
      </application>
    </icepack>
    

    Regards, Matthew
  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    matthew wrote:
    _adapter->add(new ChatSessionManagerI, Ice::stringToIdentity("ChatSessionManager"));
    
    <adapter name="ChatServer" endpoints="tcp">
     <object identity="ChatSessionManager" type="::Chat::ChatSession"/>
      <object identity="verifier" type="::Glacier2::PermissionsVerifier"/>
    

    Regards, Matthew

    I don't understand why you put type="::Chat::ChatSession" and not type="::Chat::ChatSessionManager"

    I can't configure glacier2 to contact my icepack
    glacier2router: error: service caught unhandled Ice exception:
    Network.cpp:545: Ice::ConnectionRefusedException:
    connection refused: Connection refused
    [ glacier2router: Network: accepted tcp connection
      local address = 192.168.0.3:10005
      remote address = 192.168.0.3:50121 ]
    [ glacier2router: Network: accepted tcp connection
      local address = 127.0.0.1:32785
      remote address = 127.0.0.1:47850 ]
    [ glacier2router: Network: closing tcp connection
      local address = 192.168.0.3:10005
      remote address = 192.168.0.3:50121 ]
    [ glacier2router: Network: closing tcp connection
      local address = 127.0.0.1:32785
      remote address = 127.0.0.1:47850 ]
    [ glacier2router: Network: stopping to accept tcp connections at 192.168.0.3:10005 ]
    [ glacier2router: Network: stopping to accept tcp connections at 127.0.0.1:32785 ]
    

    My glacier2 config file
    Glacier2.Client.Endpoints=tcp -h 192.168.0.3 -p 10005
    Glacier2.Server.Endpoints=tcp -h 127.0.0.1
    Glacier2.SessionManager=ChatSessionManager:tcp -h 127.0.0.1 -p 10001
    Glacier2.PermissionsVerifier=verifier:tcp -h 127.0.0.1 -p 10001
    Glacier2.SessionTimeout=30
    
    Ice.Trace.Network=3
    Ice.Trace.Protocol=3
    Ice.Warn.Connections=3
    

    ChatService code
    _adapter=communicator->createObjectAdapter(name);
    Ice::Identity id=Ice::stringToIdentity("ChatServer/ChatServer");	
    _adapter->add(new Oz::Chat::PermissionsVerifierI,Ice::stringToIdentity("verifier"));
    _adapter->add(new Oz::Chat::SessionManagerI,Ice::stringToIdentity("ChatSessionManager"));
    Oz::Chat::ChatServerPtr server=new Oz::Chat::ChatServerI(id);
    _adapter->add(server,id);
    _adapter->activate();
    

    I atacht here my icepacnode cofing files
  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    If the type of the ChatSessionManager object is ::Chat::ChatSessionManager then the descriptor should indeed use ::Chat::ChatSessionManager.

    It's difficult to say exactly what could be wrong without more information. The Ice.Default.Locator configuration property is missing from your Glacier2 configuration file however, can you add it and see if this helps?

    Benoit.
  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Glacier2 + IcePack runing ok

    Hi

    thanks for your observation beniot I added the Ice.Default.Locator and put the id of receiver and sesionManager and comunication between IcePack and Glacier2 are now runing ok and i can crete a session from my client. :D

    expecial thanks to Matthews for the article about connection managament
Sign In or Register to comment.