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

Combine java clock and counter demos - Newbie

I have a java project in which I need to to pass commands from one client through the server to another client, and have that second client send telemetry back through the server to the first client. So both clients should be publishers and subscribers, with the first client subscribing to telemetry and the second client subscribing to commands. I think this would be basically the sames as if the java clock demo and the 'counter' demo were combined, with the counter incrementing the number of messages (ticks) received and reporting that back as telemetry. The only counter demo I see is in C++; is there a java example that I'm missing, or is there a different example that better illustrates the problem? I am obviously very new to all of this.
Thank you for your time.


  • mes
    mes California

    Welcome to the forum.

    We don't provide a Java version of the counter demo, but the Java code would look very similar to the C++ version.

    Without knowing more about your application, it's hard to say whether IceStorm is the appropriate solution. The clock demo is an example of a typical publish/subscribe scenario, where publishers and subscribers are unaware of each other and IceStorm handles all interaction. The counter demo, on the other hand, shows how a server can implement the "observer" pattern by delegating to IceStorm; in this case, IceStorm is essentially an implementation detail.

    Keep in mind that IceStorm is not a message store; all events are transient and delivered only to currently-active subscribers. If your application requires a persistent message store, or if there will only be one publisher for one subscriber, then you should consider writing a custom intermediary.

    Hope that helps,