public void TearDown() { if (_server != null) { _server.Dispose(); _server = null; } }
/// <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); }
public virtual bool Stop() { if (_server != null) { _server.Dispose(); _server = null; return true; } return false; }
private void CreateServer(string name, int workers, IEnumerable<string> queues) { _server = new JobServer( Redis.Storage, name, workers, queues); }