Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I've been faced with a scenario where we need to do some heavy processing (create zip files) based on data both from custom db-tables and some data stored as Umbraco content (v8). Since the tasks are very heavy and will be long running we don't want to use a single web request to perform the processing. We're looking at something like hangfire, a windows service or a console app - either way the process will not be in the "web context".
I've seen some examples of how to use the Services APIs from a console app like this for example: https://github.com/sitereactor/umbraco-console-example
My problem is that I have some repositories that loads data from the content cache returning IPublishedContent that we convert into our domain model objects, something like:
using (var ctx = _contextFactory.EnsureUmbracoContext())
var myContent = ctx.UmbracoContext.Content.GetByKey(contentKey);
Given this scenario I was hoping for a way to use the Umbraco Content Cache outside of the web context (in a console app or in a Hangfire job). I'm not sure if this is even possible or recommended? Have anyone tried this with success or does anyone have any experience around this?
It does not really matter if the startup of this process is slow since our background task will only run once every week or so.
One solution that I've been thinking about is to perform a API-call from my background-process to get the data that I need - that would also work but I wanted to reach out here before I choose my path forward.
Can I ask if you progressed further with this? I find myself in the same situation. I'm thinking an API call to the Umbraco www instance is perhaps the only (or at least by far and away the simplest) way.
When I posted the question I was thinking about using Hangfire with a separate Windows Service as the ”processor”, but it’s also totally fine to host Hangfire inside the web application process.
For the project we worked on this “trade off” was okey at the moment but if we need to scale further we might have to change this.
Since we’re running inside the web app process we can just use the DI from Umbraco and pass any dependencies we want to our jobs so we choose that path.
If you must run out of process I don’t have much to share but if you want to try running inside the web app let me know and I’ll share some pointers and code :)
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted