Exemplo n.º 1
0
 void InitOrleans()
 {
     try
     {
         // Orleans comes with a rich XML and programmatic configuration. Here we're just going to set up with basic programmatic config
         var config = ClientConfiguration.LocalhostSilo(30000);
         GrainClient.Initialize(config);
         if (GrainClient.IsInitialized)
         {
             friend   = GrainClient.GrainFactory.GetGrain <IMsgHandler>(0);
             observer = new MsgObserver((msg) => MsgReceiver(msg));
             observer = GrainClient.GrainFactory.CreateObjectReference <IMsgObserver>(observer).Result;
             friend.Subscribe(observer).Wait();
             //var friend = GrainClient.GrainFactory.GetGrain<IHello>(0);
             //var result = friend.SayHello(textBox1.Text).Result;
             //ClientWrapper = new ConnectorClientWrapper(1,(msg) => { ucLogMessageBox1.PrintShowLogMessage(msg); });
         }
     }
     catch (Exception ex)
     {
         ucLogMessageBox1.PrintShowLogMessage(ex.Message);
         return;
     }
     ucLogMessageBox1.PrintShowLogMessage("客户端初始化成功.");
 }
Exemplo n.º 2
0
 //Also clients use this to unsubscribe themselves to no longer receive the messages.
 public Task UnSubscribe(IMsgObserver observer)
 {
     _subsManager.Unsubscribe(observer);
     return(Task.CompletedTask);
 }