Exemple #1
0
 /// <nodoc />
 public PluginClient(string ipAddress, int port, ILogger logger = null)
 {
     Channel = new Channel(
         ipAddress,
         port,
         ChannelCredentials.Insecure,
         GrpcPluginSettings.GetChannelOptions());
     PluginServiceClient = new PluginServiceClient(Channel, Channel.Intercept(new PluginGrpcInterceptor(logger)));
     Logger = logger;
 }
Exemple #2
0
        /// <nodoc />
        public virtual async Task <PluginResponseResult <List <PluginMessageType> > > GetSupportedPluginMessageType()
        {
            var requestId = GetRequestId();
            var options   = GetCallOptions(requestId);
            var request   = new PluginMessage();
            var response  = await HandleRpcExceptionWithCallAsync(
                async() => {
                var response = await PluginServiceClient.SupportedOperationAsync(request, options);

                return(response.SupportedOperationResponse.Operation.Select(op => PluginMessageTypeHelper.ToPluginMessageType(op)).ToList());
            }, requestId);

            return(response);
        }
Exemple #3
0
        /// <nodoc />
        public virtual async Task <PluginResponseResult <LogParseResult> > ParseLogAsync(string message, bool isError)
        {
            var requestId = GetRequestId();
            var options   = GetCallOptions(requestId);
            var request   = GetLogParsePluginMessage(message, isError);
            var response  = await HandleRpcExceptionWithCallAsync(
                async() =>
            {
                var response = await PluginServiceClient.ParseLogAsync(request, options);
                return(response.LogParseMessageResponse.LogParseResult);
            }, requestId);

            return(response);
        }
Exemple #4
0
        /// <nodoc />
        public virtual async Task <PluginResponseResult <bool> > StopAsync()
        {
            var requestId = GetRequestId();
            var options   = GetCallOptions(requestId);
            var request   = new PluginMessage();
            var response  = await HandleRpcExceptionWithCallAsync(
                async() =>
            {
                var response = await PluginServiceClient.StopAsync(request, options);
                return(response.Status);
            }, requestId);

            return(response);
        }