Orchard.Tasks.Scheduling Module?

Oct 23, 2010 at 11:06 AM

I would like a scheduled task function on my orchard website and if I can get a couple of high level answers then I will run with it and see how it goes.

So outcomes would be a UI for scheduled task CRUD and a way to execute it.

I think I need to create a module, is that right?

Should I use or extend Orchard.Tasks.Scheduling? If so, how?

Should I use a different library to get this done like quartz.net?

Is there anything out there already built?

Which module should I copy to get started?

Coordinator
Oct 23, 2010 at 8:25 PM

Scheduled publishing is a module that makes use of scheduling and is a good place to start to understand how this could work.

Nov 1, 2010 at 9:30 PM

I found the "Scheduled Publishing" module. It is called Orchard.ArchiveLater.

I dont want to do to much at once. I am trying to break it all down into nice little chunks.

I have CRUD working on a ScheduledTask record with 2 fields called Id and Name which i copied from Orchard.Tags.

Now when I compare what I have done with some other modules I encounter some [Model Name]PartRecord classes inheriting from ContentPartRecord?

What is that? Do I need it for what I am doing?

Coordinator
Nov 1, 2010 at 9:37 PM

Schedule Publishing is the Orchard.PublishLater one, or previously (dfault 0.8) Core.PublishLater. ArchiveLater is "Scheduled Unpublishing". They both use the scheduling API yes.

You create a class inheriting from ContentPartRecord only if you want to create a Part class which should save some properties in a table. This table would then be linked to the main content item table.

Nov 1, 2010 at 10:22 PM
Edited Nov 1, 2010 at 10:27 PM

OK, http://www.orchardproject.net/docs/Writing-a-content-part.ashx says that a Content Part is a piece of reusable functionality that can be appended to any content type in Orchard.

I needed a ScheduledTask Content Type. So I implemented the following class.
using Orchard.ContentManagement.Records;
using Orchard.Data.Conventions;

namespace ScheduledTasks.Models {
public class ScheduledTask {
public virtual int Id { get; set; }
[StringLengthMax]
public virtual string Name { get; set; }
}
}
Could you give me a couple of pointers on appending the scheduling to my ScheduledTask Content Type using the Scheduling api in the Core.
I looked in the ArchiveLater Module and found the ArchiveLaterPart class. I think I want one like that but am not sure.

 

Coordinator
Nov 1, 2010 at 10:31 PM

That is not a content type. If you want to see a content type, look at the migrations in any of the modules that create content types.

Nov 9, 2010 at 6:31 AM

Cool, thanks for that.

I have gone back and read the doco again.

Then I went had a look at the Scheduling API and how it is used.

I think I need to create a content type for a Trigger and then use that on Application Start Up to create Scheduled Tasks. Does that sound right?