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

combining Subscriber and Publisher into one client

Hi everyone,
I'm working on an assignment using Icebox to develop an Ice application on Java IDE, one of the assessment that required 2 classes that both sending and receiving data. I was only given the Ice Storm demo which have Publisher and Subscriber classes, I would like to know if there is any way to combine them into one class so that I can have a two-way system? I've already tried copy the code of subscriber into the publisher but I reecognized that it wasnt the right way.
Many thanks.


  • bernard
    bernard Jupiter, FL

    Hi Tien,

    With Ice, you have clients that use proxies to send requests to remote objects, and servers that host object implementations (known as servants) and listen for requests from clients.

    In IceStorm, we talk about about "publishers" and "subscribers": a publisher is an Ice client that sends requests to subscribers (via IceStorm), while a subscriber is an Ice object that receives these requests (via IceStorm).

    Your Subscriber servant class in Java derives from a generated "Disp" class, for example:
    (in a typical application this class would be be a standalone class, not a nested class)

    There is however no particular requirement on what a client or publisher class looks like: it just uses one or more proxies, and it does not need to derive from anything.

    You can add a proxy data member to your servant class, initialize this proxy ... and your Subscriber is now a client, possibly a Publisher if this proxy is similar to the clock proxy in the same demo: