Ejemplo n.º 1
0
        //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.Transaction.GetConnectionStatus ConnectionStatus(GetConnectionStatus request, CancellationToken cancellationToken = default)
        {
            //CallOptions = CallOptions.WithCancellationToken(cancellationToken);
            CallOptions = CallOptions.WithCancellationToken(cancellationToken);
            CallContext = new CallContext(CallOptions, CallContextFlags.IgnoreStreamTermination);
            App.Dto.Res.Transaction.GetConnectionStatus output = new App.Dto.Res.Transaction.GetConnectionStatus();
            try
            {
                using (Channel)
                {
                    ITransaction client = Channel.CreateGrpcService <ITransaction>();

                    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);
        }
Ejemplo n.º 2
0
        //public IAsyncEnumerable<TagReadIntegrationEvent> NotifyTagReadAsync(NotifyTagReq notifyTagReq, CallContext context = default) =>
        //    NotifyTagReadAsync(notifyTagReq, context.CancellationToken);

        //private async IAsyncEnumerable<TagReadIntegrationEvent> NotifyTagReadAsync(NotifyTagReq notifyTagReq, [EnumeratorCancellation] CancellationToken cancel)
        //{
        //    await foreach (var tagReadIntegrationEvent in TagGroupEventBus[notifyTagReq.GroupName + "_Read"]
        //        .GetIntegrationQueueHandler<TagReadIntegrationEvent, TagReadQueueHandler>().Dequeue(cancel))
        //    {
        //        yield return tagReadIntegrationEvent;
        //    }
        //}

        public async ValueTask <App.Dto.Res.Transaction.GetConnectionStatus> ConnectionStatusAsync(GetConnectionStatus request, CallContext context = default)
        {
            return(await _commandHandlerAsync.ExecuteWithResponseAsync <GetConnectionStatus, App.Dto.Res.Transaction.GetConnectionStatus>(_loggerFactory, _componentContext, request, context.CancellationToken));
        }
Ejemplo n.º 3
0
        //public IEnumerable<TagIntegrationEvent> NotifyTagInvoke(NotifyTagReq notifyTagReq, CallContext context = default) =>
        //    NotifyTagInvoke(notifyTagReq, context.CancellationToken);

        //private async IEnumerable<TagIntegrationEvent> NotifyTagInvoke(NotifyTagReq notifyTagReq, [EnumeratorCancellation] CancellationToken cancel)
        //{
        //    await foreach (var tagInvokeIntegrationEvent in ((IEventBusQueue)TagGroupEventBus[notifyTagReq.GroupName + "_Invoke"])
        //        .GetIntegrationQueueHandler<TagIntegrationEvent, TagInvokeQueueHandler>().Dequeue(cancel))
        //    {
        //        yield return tagInvokeIntegrationEvent;
        //    }
        //}

        //public IAsyncEnumerable<TagReadIntegrationEvent> NotifyTagReadAsync(NotifyTagReq notifyTagReq, CallContext context = default) =>
        //    NotifyTagReadAsync(notifyTagReq, context.CancellationToken);

        //private async IAsyncEnumerable<TagReadIntegrationEvent> NotifyTagReadAsync(NotifyTagReq notifyTagReq, [EnumeratorCancellation] CancellationToken cancel)
        //{
        //    await foreach (var tagReadIntegrationEvent in TagGroupEventBus[notifyTagReq.GroupName + "_Read"]
        //        .GetIntegrationQueueHandler<TagReadIntegrationEvent, TagReadQueueHandler>().Dequeue(cancel))
        //    {
        //        yield return tagReadIntegrationEvent;
        //    }
        //}

        public App.Dto.Res.Biz.GetConnectionStatus ConnectionStatus(GetConnectionStatus request, CallContext context = default)
        {
            return(_commandHandler.ExecuteWithResponse <GetConnectionStatus, App.Dto.Res.Biz.GetConnectionStatus>(_loggerFactory, _componentContext, request));
        }