Git Product home page Git Product logo

topshelf.simpleinjector's People

Contributors

andreasnilsen avatar tynor88 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

topshelf.simpleinjector's Issues

Use Custom Service

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());
    });
});

Problem when performing container.Verify

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

Support for Quartz.NET 3.x / async?

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?

FileWatcher Incorrect Fullpath/Name in TopshelfFileSytemEventArgs using subfolders

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?

Support for DefaultScopedLifestyle

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?

Help with code

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 -helpand nothing happens.

Any idea?

UseQuartzSimpleInjector interfears with Topshelf install and uninstall

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().

ScheduleQuartzJobAsService no configuration

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 & Quartz

hi,

I just found this project today and I'm hoping you can give a little guidance to the samples.

  • What's the difference between ScheduleQuartzJobAsService and ScheduleQuartzJob methods?
  • if I use ScheduleQuartzJobAsService can I just use the quartz xml scheduler?

Thanks for any help.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.