Esempio n. 1
0
        /// <summary>
        /// Create a <see cref="HostedActivityService"/> instance for processing Bot Framework Activities\
        /// on background threads.
        /// </summary>
        /// <param name="config"><see cref="IConfiguration"/> used to retrieve ShutdownTimeoutSeconds from appsettings.</param>
        /// <param name="bot">IBot which will be used to process Activities.</param>
        /// <param name="adapter"><see cref="ImmediateAcceptAdapter"/> used to process Activities. </param>
        /// <param name="activityTaskQueue"><see cref="IActivityTaskQueue"/>Queue of activities to be processed.  This class
        /// contains a semaphore which the BackgroundService waits on to be notified of activities to be processed.</param>
        /// <param name="logger">Logger to use for logging BackgroundService processing and exception information.</param>
        public HostedActivityService(IConfiguration config, IBot bot, ImmediateAcceptAdapter adapter, IActivityTaskQueue activityTaskQueue, ILogger <HostedTaskService> logger)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            if (bot == null)
            {
                throw new ArgumentNullException(nameof(bot));
            }

            if (adapter == null)
            {
                throw new ArgumentNullException(nameof(adapter));
            }

            if (activityTaskQueue == null)
            {
                throw new ArgumentNullException(nameof(activityTaskQueue));
            }

            _shutdownTimeoutSeconds = config.GetValue <int>("ShutdownTimeoutSeconds");
            _activityQueue          = activityTaskQueue;
            _bot     = bot;
            _adapter = adapter;
            _logger  = logger ?? NullLogger <HostedTaskService> .Instance;
        }
Esempio n. 2
0
 public BotController(ImmediateAcceptAdapter adapter, IBot bot)
 {
     _adapter = adapter;
     _bot     = bot;
 }