Giter Club home page Giter Club logo

hangfire.documentation's People

Contributors

1kevgriff avatar afinzel avatar allyjweir avatar ambroseya avatar armandombi avatar ascott18 avatar audriusdai avatar augustoproiete avatar bamotav avatar bert-r avatar claysonio avatar coolhome avatar danillewin avatar davevde avatar ddropinski avatar dennyferra avatar detroitpro avatar dinispeixoto avatar garrisonj avatar githubpang avatar glittle avatar holisticdeveloper avatar lukasz-madon avatar markashleybell avatar misterhux avatar odinserj avatar phrisk avatar shrinkrayio avatar ssewell avatar vojtechovsky avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hangfire.documentation's Issues

Support Chinese?

I am your fans!But I donot found is there any Chinese Documentation for Hangfire!
So I start to translate. The repository is https://github.com/jonechenug/Hangfire-Chinese-Doc
I am love to share Hangfire and hope more Chinese Developer use Hangfire!
Maybe it is no best translation,but I hope every Chinese Developer can see the Chinese Documentation when they visiting the Hangfire-Documentation website!
May you add Chinese Documentation to the website?

Documentation Request: Batch Job Status

When a batch job completes, how do we programmatically know

  • If all batch jobs completed successfully.
  • Which jobs failed?

In our case if a batch completes and its awaiting job does its cleanup work, we want it to be able to report / alert us of there were issues.

Add a note about `IBackgroundJobClient` methods in 'Writing unit tests'

http://docs.hangfire.io/en/latest/users-guide/background-methods/writing-unit-tests.html

Given the following line-to-test:

client.Enqueue(() => CheckForSpam(comment.Id));

And the call verification (using Moq):

client.Verify(x => x.Create(
    It.Is<Job>(job => job.Method.Name == "CheckForSpam" && job.Arguments[0] == comment.Id.ToString()),
    It.IsAny<EnqueuedState>());

The transition from the Enqueue method to the Create method is not obvious, and there should be a note that Enqueue, Schedule and other methods are made as extensions.

Unit testing, job

Hi,

Im trying to write some unit test and verify that a hangfire job would of been created.
I've managed to this for Enqueue but can't get it to work for Scheduled.

Here is the actual implementation -

schedule.HangfireId = _jobClient.Schedule<EmailScheduleService>(x => x.SendEmail(schedule.Id, 0, 0), schedule.ScheduleTimeUTC);

And here is the test i have to verify the method -

_mockHangfireWrapper.Verify(x => x.Schedule<EmailScheduleService>(
                b => b.SendEmail(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>()),
                It.IsAny<DateTime>()), Times.Once);

this is the error im getting -

System.NotSupportedException : Invalid verify on an extension method: x => x.Schedule<EmailScheduleService>(b => b.SendEmail(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>()), (DateTimeOffset)It.IsAny<DateTime>())
   at Moq.Mock.ThrowIfVerifyExpressionInvolvesUnsupportedMember(Expression verify, MethodInfo method) in C:\projects\moq4\src\Moq\Mock.cs:line 778
   at Moq.Mock.VerifyNonVoid(Mock mock, LambdaExpression expression, Times times, String failMessage) in C:\projects\moq4\src\Moq\Mock.cs:line 293
   at Moq.Mock`1.Verify[TResult](Expression`1 expression, Func`1 times) in C:\projects\moq4\src\Moq\Mock.Generic.cs:line 464
   at XUnitTest.Services.EmailScheduleServiceTest.ScheduleEmail_SuccessullSchedule() in C:\WS\TS\NotificationAPI\XUnitTest\Services\EmailScheduleServiceTest.cs:line 863
--- End of stack trace from previous location where exception was thrown ---

IBackgroundProcess documentation?

In Hangfire 1.5 the IBackgroundProcess interface was introduced. We are currently working on a system where we need a process that is running throughout the lifetime of our application (hosted on IIS). The IBackgroundProcess seems the way to go, but there is nothing documented regarding that subject.

Is this actually a feature or should we stay away from it?

How does this work in .NET 6?

In .NET 6, without global.asax, what do we have to do to make Hangfire start right up? And how does the part about making it stop on application end work?

windows service SQL exception

I NEED HELP

when i host the service in service log it is thowing an error like

Application: demo.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Data.SqlClient.SqlException
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(System.Data.ProviderBase.DbConnectionPoolIdentity, System.Data.SqlClient.SqlConnectionString, System.Data.SqlClient.SqlCredential, System.Object, System.String, System.Security.SecureString, Boolean, System.Data.SqlClient.SqlConnectionString, System.Data.SqlClient.SessionData, System.Data.ProviderBase.DbConnectionPool, System.String, Boolean, System.Data.SqlClient.SqlAuthenticationProviderManager)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(System.Data.Common.DbConnectionOptions, System.Data.Common.DbConnectionPoolKey, System.Object, System.Data.ProviderBase.DbConnectionPool, System.Data.Common.DbConnection, System.Data.Common.DbConnectionOptions)
at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(System.Data.ProviderBase.DbConnectionPool, System.Data.Common.DbConnection, System.Data.Common.DbConnectionOptions, System.Data.Common.DbConnectionPoolKey, System.Data.Common.DbConnectionOptions)
at System.Data.ProviderBase.DbConnectionPool.CreateObject(System.Data.Common.DbConnection, System.Data.Common.DbConnectionOptions, System.Data.ProviderBase.DbConnectionInternal)
at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(System.Data.Common.DbConnection, System.Data.Common.DbConnectionOptions, System.Data.ProviderBase.DbConnectionInternal)
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(System.Data.Common.DbConnection, UInt32, Boolean, Boolean, System.Data.Common.DbConnectionOptions, System.Data.ProviderBase.DbConnectionInternal ByRef)
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(System.Data.Common.DbConnection, System.Threading.Tasks.TaskCompletionSource1<System.Data.ProviderBase.DbConnectionInternal>, System.Data.Common.DbConnectionOptions, System.Data.ProviderBase.DbConnectionInternal ByRef) at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(System.Data.Common.DbConnection, System.Threading.Tasks.TaskCompletionSource1<System.Data.ProviderBase.DbConnectionInternal>, System.Data.Common.DbConnectionOptions, System.Data.ProviderBase.DbConnectionInternal, System.Data.ProviderBase.DbConnectionInternal ByRef)
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(System.Data.Common.DbConnection, System.Data.ProviderBase.DbConnectionFactory, System.Threading.Tasks.TaskCompletionSource1<System.Data.ProviderBase.DbConnectionInternal>, System.Data.Common.DbConnectionOptions) at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(System.Data.Common.DbConnection, System.Data.ProviderBase.DbConnectionFactory, System.Threading.Tasks.TaskCompletionSource1<System.Data.ProviderBase.DbConnectionInternal>, System.Data.Common.DbConnectionOptions)
at System.Data.SqlClient.SqlConnection.TryOpenInner(System.Threading.Tasks.TaskCompletionSource1<System.Data.ProviderBase.DbConnectionInternal>) at System.Data.SqlClient.SqlConnection.TryOpen(System.Threading.Tasks.TaskCompletionSource1<System.Data.ProviderBase.DbConnectionInternal>)
at System.Data.SqlClient.SqlConnection.Open()
at Hangfire.SqlServer.SqlServerStorage.CreateAndOpenConnection()
at Hangfire.SqlServer.SqlServerStorage.UseConnection[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.Data.Common.DbConnection, System.Func2<System.Data.Common.DbConnection,Boolean>) at Hangfire.SqlServer.SqlServerStorage.UseConnection(System.Data.Common.DbConnection, System.Action1<System.Data.Common.DbConnection>)
at Hangfire.SqlServer.SqlServerStorage.Initialize()
at Hangfire.SqlServer.SqlServerStorage..ctor(System.String, Hangfire.SqlServer.SqlServerStorageOptions)
at Hangfire.SqlServerStorageExtensions.UseSqlServerStorage(Hangfire.IGlobalConfiguration, System.String)
at MyFirstWindowsService.Service1..ctor()
at demo.Program.Main()

and my code is

using Hangfire;
using System.IO;
using System.ServiceProcess;
namespace MyFirstWindowsService
{
public partial class Service1 : ServiceBase
{
private BackgroundJobServer _server;
public Service1()
{
InitializeComponent();
GlobalConfiguration.Configuration.UseSqlServerStorage("connection string");// i have done the connection string
}

    protected override void OnStart(string[] args)
    {
        LogService("Service is Started");
        _server = new BackgroundJobServer();
        RecurringJob.AddOrUpdate("id", () => LogService("job started"), Cron.Minutely);
                  
    }
    protected override void OnStop()
    {
        LogService("Service Stoped");
    }
    private void LogService(string content)
    {
        FileStream fs = new FileStream(@"C:\harsha\log.txt", FileMode.OpenOrCreate, FileAccess.Write);
        StreamWriter sw = new StreamWriter(fs);
        sw.BaseStream.Seek(0, SeekOrigin.End);
        sw.WriteLine(content);
        sw.Flush();
        sw.Close();
    }
}

}

BackgroundJob.Enqueue job state

How can we find the state of a background job as it does not have a recurring job ID.

IStorageConnection connection = JobStorage.Current.GetConnection();
               var job = connection.GetRecurringJobs().Single(x => x.Job.Method.Name == recurringJobName);
               JobData jobData = connection.GetJobData(job.Id);
               string stateName = jobData.State;

Can this value be found as this wouldn't be part of the GetRecurringJobs() method?

Is there a way to pass an existing IDbConnection (with IDbTransaction) to the library, so that commands would go through the given connection?

Classic issue is when using NHibernate is when transaction get's distributed. Since this kind of solution mostly works in a web environment, in a single DB model, re-using NHibernate's ADO-DB connection would save us from distributed transactions (and it's side effects when using then with NHibernate).

This request relates to publishing only: since you want to execute some code then in the end publish a task - and these 2 must be done in a transaction...

The job-servers does not need this feature.

Old data removed automatically - details?

In index.rst it states that old data is removed automatically:
"Server is also responsible to keep the storage clean and remove old data automatically."
How often and which data is removed? Are there any ways to change configuration of that or do you have to write a cleanup job your self?
E.g. to make sure that database does not fill to much.

Making ASP.NET Core apps always running on IIS

From my personal experience just recently with getting an ASP.NET Core 3.1 website to always run, I think these docs could be updated. For me, the first step that was needed that's not on the hangfire docs is the same first step seen here where you check for the IIS Server Role called Application Initialization: https://www.taithienbo.com/how-to-auto-start-and-keep-an-asp-net-core-web-application-and-keep-it-running-on-iis/. I also did not need to change the CLR version of the app pool from No Managed Code to v4, which I'm glad since it's not recommended by Microsoft. I also did not need to do the last step where you're editing the web.config used by the site, which I'm also glad because it saved me from having to go through the trouble of setting that url dynamically as part of the automated deployments we do.

I'm wondering if others could give their personal experiences as well because I'm frankly not sure if these steps I didn't need to do are required for older versions of ASP.NET Core, or part of older IIS's, or dependent on the code, or anything crazy like that so I'm hesitant to remove them. I'd like to come up with a way to call that out in the docs like 'may not be required' or something like that but not sure how to word it.

Documentation for F#

Would there be an interest in adding code samples for F#?

I wouldn't mind working on it (as far as I can of course)

Extensive use of Cancellation Token checks for long running processes can cause performance issues

We have found that the use of cancellation tokens (using Hangfire v.1.6.22+) can generate a lot of database load and can significantly reduce performance of long running tasks if called too frequently. More clarity in the documentation regarding "Using cancellation tokens" that it triggers code blocking database calls should be mentioned to help other Hangfire users improve their task performance when faced with this issue.

No Documentation For IMonitoringApi

I've seen suggestions for using JobStorage.Current.GetMonitoringApi() to get information and statistics about Hangfire Jobs. The issue is that this no documentation for IMonitoringApi.
I'm having a hard time figuring out what IMonitoringApi can and cannot do.

image

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.