public virtual async Task <IActionResult> Add(int l, int r) { var adderGrain = OrleansClient.GetGrain <ICalculatorGrain>(Guid.NewGuid()); var result = await adderGrain.Add(l, r); return(Ok(result)); }
public async override Task TestApiReq3Async(Ice.Current current) { var zoneGrain13 = OrleansClient.GetGrain <IZoneGr>(13); await zoneGrain13.PushMessageForTest($"来自于grain十三的消息,啦啦啦啦啦啦啦啦{Thread.CurrentThread.ManagedThreadId}"); var contcp = current.con.getInfo() as Ice.TCPConnectionInfo; logger.Debug("TestApiReq3Async链接标识符 connectid -------- " + contcp.connectionId); }
public async override Task <bool> JoinSceneReqAsync(byte sceneid, Ice.Current current = null) { var session = this.ObtainSession(current); if (!session.IsLegalIdentify()) { return(false); } var sceneGrain = OrleansClient.GetGrain <ISceneGr>(1); //仅一个场景 var ret = await sceneGrain.JoinAsync(session.Identity); return(ret); }
public async override Task <RLResultRes> RegOrLoginReqAsync(string account, string pwd, Ice.Current current = null) { var acctGrain = OrleansClient.GetGrain <IAccountGr>(System.Guid.Empty); //统一的账户管理器 var to = await acctGrain.RegistOrLoginAsync(account, pwd); RLResultRes res = new RLResultRes() { ret = to.ret }; if (to.ret == 0) { res.idcode = to.idcode; var session = current.BindSession(to.idcode, out _); //绑定应用层身份用于推送 session?.Push <string>("__identity__", to.idcode); //设置合法性标识用于验证是否拦截 logger.Debug($"{account} 绑定标识符 {to.idcode}"); } return(res); }
public async override Task TestApiReqAsync(Ice.Current current) { var zoneGrain1 = OrleansClient.GetGrain <IZoneGr>(1); var zonekey1 = await ObserverClient.GetObserver <ZoneObserver, IZoneOb>(1); //var ccc = ObserverClient.SubscribeWrap<IZoneOb>(zonekey1, ob => { zoneGrain1.SubscribeAsync(ob); }); //logger.Debug(zonekey1 + " -------- " + ccc); //var zonekey2 = await ObserverClient.GetObserver<ZoneObserver, IZoneOb>(1); //ccc = ObserverClient.SubscribeWrap<IZoneOb>(zonekey2, ob => { zoneGrain1.SubscribeAsync(ob); }); //logger.Debug(zonekey2 + " -------- " + ccc); //var zoneGrain13 = OrleansClient.GetGrain<IZoneGr>(13); //var zonekey3 = await ObserverClient.GetObserver<ZoneObserver, IZoneOb>(13); //ccc = ObserverClient.SubscribeWrap<IZoneOb>(zonekey3, ob => { zoneGrain13.SubscribeAsync(ob); }); //logger.Debug(zonekey3 + " -------- " + ccc); var contcp = current.con.getInfo() as Ice.TCPConnectionInfo; logger.Debug("TestApiReqAsync链接标识符 connectid -------- " + contcp.connectionId); }