Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OWIN and Topshelf, no console output? #97

Open
brandorf opened this issue Apr 20, 2020 · 1 comment
Open

OWIN and Topshelf, no console output? #97

brandorf opened this issue Apr 20, 2020 · 1 comment

Comments

@brandorf
Copy link

brandorf commented Apr 20, 2020

Trying to set this up to get a bit more verbosity for our jobs.

if (_host == null)
            {
                GlobalConfiguration.Configuration.UseNinjectActivator(_kernel);
                _host = WebApp.Start
                (
                    new StartOptions
                    {
                        Port = _config.HangFirePort,
                        Urls = { $"http://+:{_config.HangFirePort}"}
                    },
                    appBuilder =>
                    {
                        new HangFireStartup(_config.HangFireSqLiteConnection, _config.Environment, _config.HangfireWorkerCount).Configuration(appBuilder, _kernel);
                    }
                );
                GlobalConfiguration.Configuration.UseConsole();
            }

and then when we start a job:

public Task Consume(ConsumeContext<SubmissionMessage> context)
        {
            BackgroundJob.Enqueue(() =>
                ProcessSubmission(GetDescriptiveJobString(context.Message.Submission), context.Message.Submission, null));
            return Task.CompletedTask;
        }

        [AutomaticRetry(Attempts = 3)]
        [DisplayName("Submission : {0}")]
        public void ProcessSubmission(string description, Submission sub, PerformContext context)
        {
            context.WriteLine($"Starting Process for {sub}...");
            // Process the submission message and create a submission request.
            var request = blah();

In my case Hangfire is running under Topshelf, and MassTransit message consumers start the jobs. I'm using the SQLLite db. Is there some other configuration I'm missing?

@brandorf
Copy link
Author

So I should add that I'm using Ninject here, and using the Hangfire.ninject nuget package, which supplies its own JobActivator. https://github.com/HangfireIO/Hangfire.Ninject/blob/master/HangFire.Ninject/NinjectJobActivator.cs

Is there some additional wireup needed for these to work together?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant