Archived

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

Various servers behind Glacier2

Hello again!!

I am studying Glacier2 and I am testing a dummy application. I use IceGrid as locator service and with Glacier2 I stablish a connection from and external client (out of my local network).

Now, I want to include another server using IceGrid, and I know that it is not necessary to use another external connection, but I don't know how to do it. I have the following specification:

#ifndef DEMO_ICE
#define DEMO_ICE
#include <Glacier2/Session.ice>

module Demo {
interface Friend {
nonmutating void sayHello();
};
interface Printer extends Glacier2::Session {
["ami"] nonmutating string getMessage(Friend* f);
};
};

#endif

And this is my descriptor:

<icegrid>
<application name="Demo">
<node name="localhost">

<server id="Printer"
exe="./Server.py"
activation="on-demand">
<adapter name="SimplePrinterAdapter"
endpoints="tcp -h 127.0.0.1"
register-process="true">
<object identity="Printer/manager" type="::Demo:Printer"/>
</adapter>
</server>

</node>
</application>
</icegrid>

If I include another interface in my Slice description, how could I access to its associated server from an external client using an unique connection with Glacier2?

My glacier2router config file is the following:

Glacier2.InstanceName=Printer
Glacier2.Client.Endpoints=tcp -h 192.168.1.5 -p 8000
Glacier2.Client.PublishedEndpoints=tcp -h ladorada.dyndns.org -p 8000
Glacier2.Server.Endpoints=tcp -h 192.168.1.5
Glacier2.SessionManager=Printer/manager
Glacier2.SessionTimeout=60
Glacier2.CryptPasswords=passwords

#Ice.Trace.Network=2
Ice.Default.Locator=IceGrid/Locator:tcp -h 127.0.0.1 -p 9090

Therefore, if I include another server behind my firewall, what value should the Glacier2.SessionManager parameter have?

I hope I have explained my problem correctly.

Thank you very much!

Comments

  • marc
    marc Florida
    You don't have to change the session manager at all, i.e., there is one session manager that your client uses, independent of the number of servers your client uses. You call the second server just like the first, by invoking on a proxy pointing to an Ice object implemented by this server. What specific problems do you have?

    As an aside, I highly recommend to read issue 1 and issue 2 of our Connections newsletter.
  • If I append another interface:

    interface NewServer extends Glacier2::Session {
    nonmutating string sayGoodbye(Friend* f);
    };

    and I specify another server in the descriptor:

    <server id="NewServer"
    exe="./NewServer.py" activation="on-demand">
    <adapter name="NewServerAdapter" endpoints="tcp -h 127.0.0.1"
    register-process="true">
    <object identity="¿¿??" type="::Demo:NewServer"/>
    </adapter>
    </server>

    How can I get an object which represents the new funcional qualities if the previous "Printer/manager" object extended from Glacier2::Session and, therefore, represents the Glacier2 connection?

    It is analogous to the chat example exposed in Connections (Issue number 1), but appending another interface and using IceGrid.

    Do you understand my explanations?

    Thank you.
  • bernard
    bernard Jupiter, FL
    Hi David,

    With Glacier2, servers are typically completely unaware of Glacier2. In particular, they don't need to implement any special interface or register any object with Glacier2.

    Creating and registering a Glacier2 SessionManager is something optional that you can do to provide sessions to your *clients*. If your clients don't need Session objects, just don't implement a SessionManager.

    A Glacier2 SessionManager must implement Glacier2::SessionManager, so I don't see how your first example works:
    Glacier2.SessionManager=Printer/manager
    

    (since Printer/manager is a Glacier2::Session, not a Glacier2::SessionManager)

    See "Session Management" in the Glacier2 chapter of the Ice manual. For your first Glacier2 experiments, I'd recommend to skip this feature.

    Cheers,
    Bernard
  • Thank you for your explanations!

    I had a wrong conception of Glacier2, but now I understand its operation correctly. :)

    Thank you again,
    David.