Hi,
Im trying to make my client unaware of the executing code for the job.
But when i pass an interface in the job creation, the job never fires on the server. What do i do wrong?
This does not work
BackgroundJob.Enqueue(x => x.ExecuteJob(notification));
But this of course do
BackgroundJob.Enqueue(x => x.ExecuteJob(notification));
The client is an API, and i want to add a genric way to create the job so i dont have to redeploy the api for new jobs. And handle the implementation in the server service. How can i accomplish this?
I could not edit the post “The cody was to similar”
Here are the code samples formatted
This does not work
BackgroundJob.Enqueue<ISubscriber>(x => x.ExecuteJob(notification));
But this of course do
BackgroundJob.Enqueue<Subscriber>(x => x.ExecuteJob(notification));
For anyone having the same problem in the future.
The solution was to add the job with interface in the client
BackgroundJob.Enqueue<ISubscriber>(x => x.ExecuteJob(notification));
And then use dependency injection in the server code
services.AddSingleton<ISubscriber, Subscriber>();