Esempio n. 1
0
 public void TearDown()
 {
     if (_server != null)
     {
         _server.Dispose();
         _server = null;
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Starts the server and all its workers.
        /// </summary>
        public virtual void Start()
        {
            if (_server != null)
            {
                    throw new InvalidOperationException("Background job server has already been started. Please stop it first.");    
            }

            var serverName = String.Format("{0}:{1}", MachineName.ToLowerInvariant(), Process.GetCurrentProcess().Id);

            _server = new JobServer(JobStorage.Current, serverName, WorkerCount, Queues);
        }
Esempio n. 3
0
        public virtual bool Stop()
        {
            if (_server != null)
            {
                _server.Dispose();
                _server = null;

                return true;
            }
            return false;
        }
Esempio n. 4
0
 private void CreateServer(string name, int workers, IEnumerable<string> queues)
 {
     _server = new JobServer(
         Redis.Storage,
         name,
         workers,
         queues);
 }