tynor88 / topshelf.simpleinjector Goto Github PK
View Code? Open in Web Editor NEWPut your apps on the Topshelf, with the power of SimpleInjector & Quartz.NET!
License: MIT License
Put your apps on the Topshelf, with the power of SimpleInjector & Quartz.NET!
License: MIT License
Looks a bit weird that the constructor is used to initialise a static value.
Hi,
I previously briefly discussed this in #3 but I'm wondering if you would mind further commenting. I'm trying to get my service using your component to just use the xml configuration file to schedule and create jobs. The ScheduleQuartzJobAsService takes a delegate for jobConfigurator. Do I need to explicitly configure each job including trigger in order for quartz to pick it up or can I merely configure the quartz job?
Topshelf FileSystemWatcher: 1.0.0.20
Processing the event action method when using sub-folders the contents of the TopshelfFileSytemEventArgs.FullPath and Name property seems to be incorrect.
Example, currently watching C:/tmp
Add contents to C:/tmp/incorrect (a.txt)
TopshelfFileSytemEventArgs received in the Action method reads as follows:
e.FullPath = "C:\tmp\incorrect\incorrect\a.txt"
e.Name = "incorrect\a.txt"
Is this something that you have observed?
How would you go about using a custom service for the FileSystemWatcher?
HostFactory.New(x =>
{
x.Service<MyService>(sc =>
{
sc.ConstructUsing(() => new MyService());
// the start and stop methods for the service
sc.WhenStarted(s => s.Start());
sc.WhenStopped(s => s.Stop());
sc.WhenFileSystemCreated(...)
// optional pause/continue methods if used
sc.WhenPaused(s => s.Pause());
sc.WhenContinued(s => s.Continue());
// optional, when shutdown is supported
sc.WhenShutdown(s => s.Shutdown());
});
});
I ran the unit test suite and was using Reshaper Runner that happened to include the word "Installation" as part of the Runner path (this is probably the default installation directory). Consequently Line 56 in SimpleInjectorScheduleJobServiceConfiguratorExtensions.cs caused a unit test to fail:
Environment.GetCommandLineArgs()
needs to be Environment.GetCommandLineArgs().Skip(1)
Thanks!
If you use config.UseQuartzSimpleInjector(_container); as is done in the QuartzAsService.Sample, the TopShelf install and uninstall operations succeed however they do not complete, causing he user to have to end the process by using ctrl+c. This becomes an issue for spripted/automated deployments. In order to work around this behavior the following line must be executed durring an install or uninstall.
ScheduleJobServiceConfiguratorExtensions.SchedulerFactory().Shutdown();
I suspect the root of this issue is related to the creation of the scheduler via the call schedulerFactory.GetScheduler() in the SetupQuartzSimpleInjector() method. Perhaps this method could determine if a TopShelf install or uninstall operation is being executed and if so then exit the SetupQuartzSimpleInjector without calling schedulerFactory.GetScheduler().
hi,
I just found this project today and I'm hoping you can give a little guidance to the samples.
Thanks for any help.
I've recently migrated to Simple Injector 3.1.2 and started using the new LifeStyle.Scoped feature.
However, this causes Quartz.NET to fail (I use a shared DR-layer), because the container.BeginLifetimeScope() is never called and therefore no services can be resolved.
Is there a way I can configure your package to make this work?
I'm fairly new to Topshelf and Quartz. I just discovered those libraries and they are awesome.
I'm pretty fan of SimpleInjector and I use it in every project.
I have the following:
static class Program
{
static void Main(string[] args)
{
var container = Bootstrapper.Run();
var settings = container.GetInstance<SettingsRepository>();
HostFactory.Run(config =>
{
config.UseQuartzSimpleInjector(container);
config.ScheduleQuartzJobAsService(c =>
c.WithJob(() =>
JobBuilder.Create<BondServiceJobAdapter>()
.WithIdentity("TesouroDireto")
.WithDescription("Tarefa para buscar os títulos do site Tesouro Direto")
.Build())
.AddTrigger(() =>
TriggerBuilder.Create()
.WithSimpleSchedule(b => b
.WithInterval(settings.GetByKey<TimeSpan>("Windows_Service_Delay"))
.RepeatForever())
.Build()));
config.RunAsLocalSystem();
config.SetDisplayName("Serviço Tesouro Direto");
});
}
}
Compile just fine.
I run the myservice.exe -help
and nothing happens.
Any idea?
Will this library be updated for Quartz.NET 3.x and the rewrite to async support for IJob, or should I roll my own decorators and DI setup if I wish to use Quartz.NET 3.x?
Hello,
I'm trying to use your nuget package with my .NET Framework 4.6 application and I've got a single job I need to execute.
In my program.cs I do
await ServiceStartupConfigurator.RegisterServices(_container);
var rc = HostFactory.Run(x =>
{
// x.UseSerilog(Log.Logger);
// Pass it to Topshelf
x.UseQuartzSimpleInjector(_container);
_container.Verify();
x.Service<ScheduleService>(s =>
{
s.ConstructUsingSimpleInjector();
s.ConstructUsing(name => new ScheduleService());
s.WhenStarted(tc => tc.Start());
s.WhenStopped(tc => tc.Stop());
});
x.RunAsLocalSystem();
x.SetDescription(ConfigurationManager.AppSettings.Get("serviceDescription"));
x.SetDisplayName(ConfigurationManager.AppSettings.Get("serviceDisplayName"));
x.SetServiceName(ConfigurationManager.AppSettings.Get("serviceName"));
});
and on the verify I got
System.InvalidOperationException: 'The configuration is invalid. Creating the instance for type IScheduler failed. The registered delegate for type IScheduler threw an exception. Impossibile trovare il metodo 'Quartz.IScheduler Quartz.ISchedulerFactory.GetScheduler()'.'
What am i doing wrong?
I'm using the following nugets
<package id="Common.Logging" version="3.4.1" targetFramework="net46" />
<package id="Common.Logging.Core" version="3.4.1" targetFramework="net46" />
<package id="log4net" version="2.0.5" targetFramework="net46" />
<package id="Microsoft.CSharp" version="4.0.1" targetFramework="net46" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net46" />
<package id="Quartz" version="3.0.7" targetFramework="net46" />
<package id="RestSharp" version="106.12.0" targetFramework="net46" />
<package id="Serilog" version="2.10.0" targetFramework="net46" />
<package id="Serilog.Settings.AppSettings" version="2.2.2" targetFramework="net46" />
<package id="Serilog.Sinks.Console" version="4.0.0" targetFramework="net46" />
<package id="Serilog.Sinks.File" version="3.2.0" targetFramework="net46" />
<package id="Serilog.Sinks.RollingFile" version="3.3.0" targetFramework="net46" />
<package id="SimpleInjector" version="5.3.2" targetFramework="net46" />
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net46" />
<package id="Topshelf" version="4.3.0" targetFramework="net46" />
<package id="Topshelf.Quartz" version="0.4.0.0" targetFramework="net46" />
<package id="Topshelf.Serilog" version="4.3.0" targetFramework="net46" />
<package id="Topshelf.SimpleInjector" version="1.0.0.20" targetFramework="net46" />
<package id="Topshelf.SimpleInjector.Quartz" version="1.0.0.20" targetFramework="net46" />
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.