public void deregister(Holon holon) { //remove from IceGrid and from local adapter //this must be called before closing!! //logger.Info("Deregistring holon: " + holon.getName()); Ice.Identity iceid = holon.Proxy.ice_getIdentity(); _deregister(iceid); _ServantIds.Remove(iceid); }
public void subscribeEvent(Holon holon, string topicName) { IceStorm.TopicPrx topic = getTopic(topicName); Dictionary <string, string> qos = new Dictionary <string, string>(); qos["reliability"] = ""; //#"" and "ordered" are the only possibilities see doc qos["retryCount"] = "-1"; // #-1 means to never remove a dead subscriber from list try { topic.subscribeAndGetPublisher(qos, holon.Proxy); } catch (IceStorm.AlreadySubscribed) { logger.Info("Allready subscribed to topic, that is ok"); } logger.Info(holon.Proxy + " subscribed to " + topicName); }
static void Main() { Console.WriteLine ("Starting"); IceApp app = null; Holon holon = null; Robot robot = null; try { //app = new IceApp("localhost", 12000); app = new IceApp("MyTestAdapter", "localhost", 12000); holon = new Holon(app, "MyTestHolon"); robot = new Robot(app, "MyRobot"); Console.WriteLine(holon.Name + " starting"); app.subscribeEvent(holon, "MyTopic"); hms.GenericEventInterfacePrx pub = app.getEventPublisher("MyTopic"); Thread.Sleep(1000); hms.Message msg = new hms.Message() ; msg.arguments = new System.Collections.Generic.Dictionary<string, string>(); msg.arguments.Add("mynewargs", "totoisback"); pub.putMessage(msg); Thread.Sleep(10000); pub.putMessage(msg); Console.WriteLine ("Sleeping"); Thread.Sleep(10000); Console.WriteLine ("Cleanup"); } finally { if (robot != null ) { robot.shutdown(); } if (holon != null ) { holon.shutdown(); } if ( app != null ) { app.shutdown(); } } }
public void subscribeEvent(Holon holon, string topicName) { IceStorm.TopicPrx topic = getTopic(topicName); Dictionary<string, string> qos = new Dictionary<string, string>(); qos["reliability"] = ""; //#"" and "ordered" are the only possibilities see doc qos["retryCount"] = "-1"; // #-1 means to never remove a dead subscriber from list try { topic.subscribeAndGetPublisher(qos, holon.Proxy); } catch (IceStorm.AlreadySubscribed) { logger.Info("Allready subscribed to topic, that is ok"); } logger.Info(holon.Proxy + " subscribed to " + topicName); }