21 Replies
Is BackgroundJobClient your class that you wrote?
No, I inject IBackgroundJobClient in MediatorHandler in this case
so your problem is that hangfire identifies jobs with integers instead of guids?
yes
why do you think it's not giving you unique IDs?
because it is
You could add another table that associates integers with guids
It is giving, but I need to pass it to the function before the output from .Schedule method returns
it doesn't have an ID until you schedule it
As it is described in the posted screenshoot, I need to pass ID of the scheduledplan to the PlanTransmissionRequested object
but its impossible when dealing with ints
database-generated
i meant
i'm still not understanding the problem
are you using hangfire generated IDs or your own IDs?
Okay, lemme describe again.
I want to use Guid as ID for my entire project.
When user is scheduling notification on specific time, it is added to my OWN database ( ScheduledJob -> described in the post ). Once it is invoked, this ScheduledJob should be deleted from the database as it is no longer active ( executed ). That is why I need to pass a scheduled job id to the PlanTransmissionRequested object ( see post )
what if you just make the job check if the request still exists, and do nothing if it doesn't
I dont get it (
i would assume your mediatr handler already has error handling for invalid plans
One sec
I hope it helps
On the last screenshot I would delete executed active ScheduledJob from my database
It would be perfect if I could pass my own id to the .Schedule method, but unfortunately
as I pass in .AddOrUpdate
I did it like this, but if someone has a better solution ( make Hangfire return guid or smth ) please, help me.
as nobody replied, I made it the easiest way I found out -> https://github.com/Lyakabynka/PlanIt/
if somebody is interested
GitHub
GitHub - Lyakabynka/PlanIt
Contribute to Lyakabynka/PlanIt development by creating an account on GitHub.
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.