Could members of the forum offer suggestions on how to implement a spooler?
The requirement is to post to a large number of users, too many to wait for completion.
The list of users would need to be spooled to a persistent data store and a thread would need to consume each member of this list.
1) What would be the most appropriate way of storing a reference list in umbraco? Custom tree?
2) Is there service/event to be hooked into to achieve an unattended consume of the list? Could it recover from a server reboot to continue where left off?
Within Umbraco you can setup ScheduledTasks; these tasks are basically calls to a url at a set time. They are defined in config/scheduledtask.config
<scheduledTasks> <!-- add tasks that should be called with an interval (seconds) --> <task log="true" alias="test60" interval="120" url="http://localhost/umbraco/plugins/whatever.aspx"/> </scheduledTasks>
You could create a task that checks to see if csv/xml file of members has been uploaded and adds each user to the data store. You would create a variable in the Application state that is updated with the current member import id.
To recover from a server reboot you may need to store this state to the filesystem or update a field on an Umbraco page (i.e. store it in the DB).
Personally I'd create a Thread and store a reference to it in Application.Context. The thread will then continue to run as long as the Application is alive.
In the case of a consumer task your suggestion would lead me to a scheduled 'watcher' event which could launch a thread to consume anything remaining in the spool; good advice.
Is an umbraco page the only option for data storage in umbraco? In this case the spool wouldn't contain anything but black box data and a document appearing in the ui would be redundant.
Data can be stored anywhere, so custom tables to store your black box data would do fine. Custom task takes care of reading/update data from the db and do whatever it has to do with it.
Implementing async behaviour
Could members of the forum offer suggestions on how to implement a spooler?
The requirement is to post to a large number of users, too many to wait for completion.
The list of users would need to be spooled to a persistent data store and a thread would need to consume each member of this list.
1) What would be the most appropriate way of storing a reference list in umbraco? Custom tree?
2) Is there service/event to be hooked into to achieve an unattended consume of the list? Could it recover from a server reboot to continue where left off?
Cheers
Robert
Hi Robert,
Welcome to the forum and Umbraco.
Within Umbraco you can setup ScheduledTasks; these tasks are basically calls to a url at a set time. They are defined in config/scheduledtask.config
You could create a task that checks to see if csv/xml file of members has been uploaded and adds each user to the data store. You would create a variable in the Application state that is updated with the current member import id.
To recover from a server reboot you may need to store this state to the filesystem or update a field on an Umbraco page (i.e. store it in the DB).
Personally I'd create a Thread and store a reference to it in Application.Context. The thread will then continue to run as long as the Application is alive.
HTH
Chris
Thank you, its good to be here.
In the case of a consumer task your suggestion would lead me to a scheduled 'watcher' event which could launch a thread to consume anything remaining in the spool; good advice.
Is an umbraco page the only option for data storage in umbraco? In this case the spool wouldn't contain anything but black box data and a document appearing in the ui would be redundant.
Robert
Robert,
Data can be stored anywhere, so custom tables to store your black box data would do fine. Custom task takes care of reading/update data from the db and do whatever it has to do with it.
Cheers,
/Dirk
Dirk's right, you can store data in custom tables, xml, basically anything you can do with .NET.
Storing data in a node may seem redundant, but it's a quick (and dirty?) way of acheiving what you're after.
You can 'hide' the node from your clients using the settings in the User section, so no one needs to know it's there.
is working on a reply...