0

I'm working with .NET Core 5 in a monolithic application, it has many IHostedServices that affect performance and I wanted to convert them all to microservices. I can't find any examples of microservices that run automatically at an interval. What would be the correct way to implement this?

Edit:

I want to separate my application from hosted services, I thought about creating another .NET Core application just to run each of these hosted services. Would it be correct to create a clean project using the same database running only with the hosted service?

Paul
  • 11
  • 4
  • there are many ways to schedule processes (cron, airflow, etc.) - you'd need to be more specific about your problem – Arnon Rotem-Gal-Oz Nov 13 '21 at 12:21
  • Does this answer your question? [How to run BackgroundService on a timer in ASP.NET Core 2.1](https://stackoverflow.com/questions/53727850/how-to-run-backgroundservice-on-a-timer-in-asp-net-core-2-1) – Martin Nov 13 '21 at 13:44
  • @ArnonRotem-Gal-Oz I edited the question with what I thought to do, is what I thought correct? – Paul Nov 14 '21 at 22:02
  • @Martin I don't want to run the service in my monolithic application, I want to separate it, my question is if it is correct to create a .NET Core application just to run a hosted service? – Paul Nov 14 '21 at 22:04
  • @Paul yes it is. Create a .NET for all your HostedServices and you have them running independently. But if this is the right way in your case really depends on how the rest of your application is architeted. But its a good starting point ;) – Martin Nov 15 '21 at 08:20

0 Answers0