You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I have a custom IApplyStateFilter that is used in all my Hangfire servers. In the OnStateApplied implementation I send a SignalR notification to registered clients. Sometimes a client cannot receive the job (and associated data) as the job is not in the expected state, when this is implemented like this: JobStorage.Current.GetMonitoringApi().SuccededJobs.
This is because OnStateApplied is invoked before the database transaction is executed (this is also documented somewhere). Persistance is done by the CoreStateMachine after OnStateApplied:
The only way to notify my clients after the transaction seems to require custom IStateHandler (each corresponding to a Hangfire built-in state) which invoke a a custom OnStatePersisted Command in the Apply method.
Is this the right approach or do you see a better solution?
Best regards
The text was updated successfully, but these errors were encountered:
Hello,
I have a custom IApplyStateFilter that is used in all my Hangfire servers. In the OnStateApplied implementation I send a SignalR notification to registered clients. Sometimes a client cannot receive the job (and associated data) as the job is not in the expected state, when this is implemented like this:
JobStorage.Current.GetMonitoringApi().SuccededJobs
.This is because OnStateApplied is invoked before the database transaction is executed (this is also documented somewhere). Persistance is done by the CoreStateMachine after OnStateApplied:
Hangfire/src/Hangfire.Core/States/StateMachine.cs
Line 95 in 0d3d895
The only way to notify my clients after the transaction seems to require custom IStateHandler (each corresponding to a Hangfire built-in state) which invoke a a custom OnStatePersisted Command in the Apply method.
Is this the right approach or do you see a better solution?
Best regards
The text was updated successfully, but these errors were encountered: