コード例 #1
0
        public Task <object> ExecuteCommand(int command, object arg)
        {
            if (command >= (int)PersistentStreamProviderCommand.AdapterCommandStartRange &&
                command <= (int)PersistentStreamProviderCommand.AdapterCommandEndRange &&
                queueAdapter is IControllable)
            {
                return(((IControllable)queueAdapter).ExecuteCommand(command, arg));
            }

            if (command >= (int)PersistentStreamProviderCommand.AdapterFactoryCommandStartRange &&
                command <= (int)PersistentStreamProviderCommand.AdapterFactoryCommandEndRange &&
                adapterFactory is IControllable)
            {
                return(((IControllable)adapterFactory).ExecuteCommand(command, arg));
            }

            if (pullingAgentManager != null)
            {
                return(pullingAgentManager.ExecuteCommand((PersistentStreamProviderCommand)command, arg));
            }

            logger.Warn(0, String.Format("Got command {0} with arg {1}, but PullingAgentManager is not initialized yet. Ignoring the command.",
                                         (PersistentStreamProviderCommand)command, arg != null ? arg.ToString() : "null"));
            throw new ArgumentException("PullingAgentManager is not initialized yet.");
        }
コード例 #2
0
 public Task <object> ExecuteCommand(int command, object arg)
 {
     if (pullingAgentManager != null)
     {
         return(pullingAgentManager.ExecuteCommand((PersistentStreamProviderCommand)command, arg));
     }
     logger.Warn(0, String.Format("Got command {0} with arg {1}, but PullingAgentManager is not initialized yet. Ignoring the command.",
                                  (PersistentStreamProviderCommand)command, arg != null ? arg.ToString() : "null"));
     throw new ArgumentException("PullingAgentManager is not initialized yet.");
 }