コード例 #1
0
ファイル: Biz.cs プロジェクト: maniepiedi/KSociety.Com
        //public IAsyncEnumerable<TagReadIntegrationEvent> NotifyTagReadAsync(Srv.Dto.Common.NotifyTagReq request, CancellationToken cancellationToken = default)
        //{
        //    CallOptions = CallOptions.WithCancellationToken(cancellationToken);
        //    using (Channel)
        //    {
        //        ITransactionAsync client = null;

        //        client = Channel.CreateGrpcService<ITransactionAsync>();

        //        return client.NotifyTagReadAsync(request, CallOptions);
        //    }
        //}

        public App.Dto.Res.Biz.GetConnectionStatus ConnectionStatus(GetConnectionStatus request, CancellationToken cancellationToken = default)
        {
            //CallOptions = CallOptions.WithCancellationToken(cancellationToken);
            CallOptions = CallOptions.WithCancellationToken(cancellationToken);
            CallContext = new CallContext(CallOptions, CallContextFlags.IgnoreStreamTermination);
            App.Dto.Res.Biz.GetConnectionStatus output = new App.Dto.Res.Biz.GetConnectionStatus();
            try
            {
                using (Channel)
                {
                    IBiz client = Channel.CreateGrpcService <IBiz>();

                    var result = client.ConnectionStatus(request, CallContext);

                    output = result;
                }
            }
            catch (Exception ex)
            {
                Logger.LogError(GetType().FullName + "." + System.Reflection.MethodBase.GetCurrentMethod()?.Name + " - " + ex.Source + " " + ex.Message + " " + ex.StackTrace);
            }
            return(output);
        }