If you remember what we talked about earlier with inheritance, we now need to implement the interface methods we are getting from IBaseMicroService. Let's begin with our Start method. This method basically configures and starts our timer for us:
public virtual bool Start(HostControl hc)
{_host = hc;
Console.WriteLine(_name + string.Intern("Service Started."));
Assumes.True(_timer!= null, string.Intern("_timer is null"));
_timer.AutoReset = true;
_timer.Enabled = true;
_timer.Start();
return true;
}
Next comes our Stop method. This method will log that our service has stopped, stop our timer, and close our RabbitMQ connections and channels for proper cleanup:
public virtual bool Stop()
{
Assumes.True(_log != null, string.Intern("_log is null"));
_log?.Info(_name + string.Intern(" Service is Stopped"));
Assumes.True(_timer...