This project is read-only.

Long running tasks question

Topics: Customizing Orchard, General, Writing modules
Jan 20, 2015 at 9:36 PM
What I am trying to do:

I have a few requirements for a project I am working on that will need something like message queue functionality. ie
User posts a pdf to server for processing via a webapi. The url of the file is stored in a table/message queue and returns without item being processed. Then a service (or something) looks for the items in the table/message queue and starts a long running process. when complete go back to polling every 15 minutes for more items to process.

I have several other use cases that are similar to this, post data that will be longer running to process and do not need immediate results returned from webapi.

I have played around with workflows to accomplish this but ran into some road blocks. Also, I don't need any UI for this process so it doesn't seem to be a fit.

I am using Azure and have looked at using webjobs but I have requirements that need to use some content items as part of these situations. So executables outside of orchard don't seem to work for me.

In short I am looking for examples of long running, automatically starting and with the ability to use orchard. please point me to blog posts, sample code, projects and modules that might have what I am looking for.


Jan 20, 2015 at 10:49 PM
Such long running tasks are less suitable for background tasks and better for separate workers (like Web Jobs). You could write an Orchard-based Web Job though with Orchard Application Host, that communicates with the same DB as the website (or not).
Jan 21, 2015 at 12:37 AM

I remember this from the weekly meetings, have you guys been using it in webjobs? Or will I be the guinea pig? Regardless this looks exactly like what I need to use, thankyou!
Jan 21, 2015 at 6:14 PM
Haven't tried Web Jobs, but since those can be ultimately any executable there shouldn't be any issues, because you can just write a console app.
Apr 24, 2015 at 4:13 PM

We have a similar problem, we have a "heavy" service, that is currently working using Background tasks and the module Woker Service.

It would be really cool if we could use the Orchard App Host to build a service, reusing almost all the Orchard CMS custom module code and running the "heavy" duty jobs outside the the site app.

@Piedone is possible to run an instance of Orchard App Host that shares the DB with live instance of Orchard?.

Apr 26, 2015 at 3:41 AM
Yes, it's entirely possible. However keep in mind that this is the same as running a multi-server Orchard instance, so you have to think about everything this impacts (e.g. having to restart the shells in both apps when you enable/disable a feature).
Apr 27, 2015 at 6:58 PM

Thanks, I'm not going to implement this now but I'll write my experience after the development of this feature!.