Java: Difference between revisions

From Open Rail Data Wiki
Gavco98uk (talk | contribs)
Created page with "<code> private static void go() throws Exception { System.out.println("Connecting"); final Client c = new Client(Constants.SERVER, Constants.PORT, Constants.…"
 
Gavco98uk (talk | contribs)
No edit summary
Line 24: Line 24:
     }
     }
</code>
</code>
Requires [[http://www.germane-software.com/software/Java/Gozirra/ Gozirra Stomp library]]
Requires [http://www.germane-software.com/software/Java/Gozirra/ Gozirra Stomp library]

Revision as of 14:42, 26 July 2012

private static void go() throws Exception
   {
       System.out.println("Connecting");
       final Client c = new Client(Constants.SERVER, Constants.PORT, Constants.USERNAME, Constants.PASSWORD);
       System.out.println("Connected");
       System.out.println("Subscribing");
       for (final String topic : Constants.TOPICS)
       {
           System.out.println("  " + topic);
           c.subscribe("/topic/" + topic,
                   new Listener()
                   {
                       public void message(Map map, String s)
                       {
                           processMessage(map, s);
                       }
                   });
       }
       System.out.println("done subscribing");
   }

Requires Gozirra Stomp library