예제 #1
0
 /// <nodoc />
 public static void SetGrpcPluginClientBasedOnMessageType(IPlugin plugin, PluginMessageType messageType)
 {
     //switch(messageType)
     //{
     //    case PluginMessageType.ParseLogMessage:
     //        plugin.SetLogParsePluginClient();
     //        break;
     //    default:
     //        break;
     //}
 }
예제 #2
0
        /// <nodoc />
        private async Task <Possible <T> > CallWithEnsurePluginLoadedWrapperAsync <T>(PluginMessageType messageType, IPlugin plugin, Func <Task <PluginResponseResult <T> > > call, T defaultReturnValue)
        {
            EnsurePluginLoaded(plugin);

            var sw = Stopwatch.StartNew();

            try
            {
                var response = await call.Invoke();

                sw.Stop();
                Interlocked.Increment(ref m_pluginProcessedRequestCounts);
                Interlocked.Add(ref m_pluginTotalProcessTime, sw.ElapsedMilliseconds);

                Tracing.Logger.Log.PluginManagerLogMessage(m_loggingContext, string.Format(CultureInfo.InvariantCulture, ResponseReceivedLogMessageFormat, response.RequestId, messageType, sw.ElapsedMilliseconds, response.Attempts));
                return(response.Succeeded ? response.Value : new Possible <T>(response.Failure));
            }
            catch (Exception e)
            {
                Tracing.Logger.Log.PluginManagerLogMessage(m_loggingContext, $"grpc call with type {messageType.ToString()} failed with {e}");
                return(new Failure <T>(defaultReturnValue));
            }
        }
예제 #3
0
 /// <nodoc />
 public bool CanHandleMessage(PluginMessageType messageType)
 {
     return(m_pluginHandlers.TryGet(messageType, out _));
 }