X
GO

PASSIONATE TO ACHIEVE

Proactive and constant efforts, Values your feedback, Clear communication and Responsive. The client's success is our target!

Contact Us


DotNetNuke Scheduler (Schedule a Task in DNN)


DotNetNuke Scheduler (Schedule a Task in DNN)

DotNetNuke (DNN) is an open-sourced and free content management system (CMS) built on the ASP.NET technology from Microsoft. Users may build and manage websites, web apps, and intranet portals with this strong and adaptable CMS.

DNN's scheduler, which enables users to automate operations like content publishing, database backups, and more, is one of its important features. You can plan jobs and events on your DotNetNuke website using the robust utility known as DotNetNuke Scheduler. It can be used for a range of tasks, including database administration and email sending. The DotNetNuke Scheduler's capabilities and advantages will be covered in this post, along with how it can improve the way you manage your website.

What is the DotNetNuke Scheduler?

Within the DotNetNuke platform, there exists a component known as the DotNetNuke Scheduler. This tool allows for task scheduling, enabling the creation of jobs that run at predetermined intervals or durations. Various operations can be carried out through this feature, such as sending emails, executing SQL scripts, and performing maintenance tasks. By configuring the scheduler, predefined procedures can be implemented as technical tasks, triggered by specific times or events. Essentially, the scheduler allows for programming operations to be executed as scheduled tasks.

One of the key advantages of using the DotNetNuke Scheduler is that it reduces the amount of manual effort required to execute routine tasks. By automating these tasks, website administrators can free up time to focus on higher-value activities such as content creation and customer engagement. In addition, the scheduler can help ensure that critical processes are executed consistently and on schedule, reducing the risk of errors or omissions.

The DotNetNuke Scheduler is very flexible and may be customized to conduct a wide range of operations, from simple database backups to complicated data processing scripts. Administrators can establish particular start timings and finish times for each activity, as well as schedule tasks to run at predetermined intervals, such as daily, weekly, or monthly. Moreover, a broad variety of job kinds, such as SQL scripts, URL requests, and unique code snippets, are supported by the Scheduler.

The DotNetNuke Scheduler's features and advantages

The DotNetNuke Scheduler is a useful tool for managing your website because it has a lot of capabilities. Among the essential characteristics are:

Task Scheduling: You can plan tasks to perform at certain periods or intervals using the Scheduler. This enables you to automate processes that ordinarily call for manual involvement.

Flexibility: The Scheduler is incredibly adaptable and may be set up to carry out a variety of activities. This entails executing SQL programmes, sending emails, and carrying out various maintenance duties.

Security: The Scheduler may be set up to conduct tasks only under specific circumstances and is very secure. This makes sure that delicate duties are only carried out when necessary.

Notifications: As tasks are finished or when issues happen, the Scheduler can be set to deliver notifications. This enables you to keep track of the progress of your planned chores.

Logging: The Scheduler records all task activity, giving you a thorough history of all executed scheduled tasks.

How to Use DNN Scheduler

Simple steps are required to use the DotNetNuke Scheduler. You must first navigate to the Scheduler module on your DotNetNuke website to begin going. You can set up new jobs to execute at particular times or intervals from this point.

The kind of task, the frequency with which it should run, and any other necessary criteria must all be specified when creating a new task. Moreover, the task can be set up to only execute in specified circumstances, such as when a specific file is present or a particular database query returns a particular result.

A task can be tested after it has been created to make sure it functions as intended. The Scheduler module, which offers thorough details about each task's status, also allows you to keep track of task activity. Here detailed steps mentioned https://www.dnnsoftware.com/docs/developers/scheduler/configure-scheduler.html

To enable or disable scheduled tasks in DotNetNuke, you can follow these simple steps:

To enable or disable all tasks on your site:

  1. Log in to your site as a host user.
  2. Navigate to Host > Host Settings > Other Settings.
  3. Find the Scheduler Mode drop-down list and select the option that best suits your needs. The three options available are:
  • Disabled: Scheduled tasks will never execute.
  • Timer Method: Scheduled tasks will be executed as soon as they are due, in their own thread of execution. They will be executed regardless of whether or not pages are being requested on the site.
  • Request Method: Scheduled tasks will be executed at the beginning of the next page request following the time at which they are due. They will only be executed if pages are being requested from the site. A page load that triggers a scheduled task must wait for the task to complete before the request can complete.
  • Click Update.

For faster performance, it is recommended to use the Timer method. Since the ASP.NET application is always in memory thanks to a KeepAlive service, the application pool is always running, and scheduled tasks are triggered on time.

To disable or enable individual scheduled tasks:

  1. Log in to your site as a host user.
  2. Navigate to Host > Schedule.
  3. Click the Edit button next to the task you want to disable or enable.
  4. Check or uncheck the Schedule Enabled box.
  5. Click Update.

By following these steps, you can easily manage your scheduled tasks in DotNetNuke and ensure that they are running as intended.

Technical: DNN Scheduler

At its core, a DotNetNuke scheduled job is a class that inherits from the SchedulerClient base class. By overriding the "DoWork" method, you can customize the action that the job performs. The SchedulerClient base class also provides access to a ScheduleHistoryItem class, which allows your process to report success or failure and provide helpful information to users through the "History" reporting feature in DotNetNuke.

While this may seem straightforward, there is one important consideration to keep in mind when working with scheduled jobs: the "Scheduler Mode" property in Host Settings. If the scheduler is set to "Timer Mode" (which is the recommended setting), scheduled jobs will not have access to an HttpContext while processing, which can make file access more challenging. It's important to be aware of this limitation and plan your scheduled jobs accordingly.

Building DotNetNuke scheduled jobs is a straightforward process that can be a highly effective way to manage batch or offline processing requirements. By implementing proper planning and logging, you can seamlessly handle even the most complex business needs.

using DotNetNuke.Services.Exceptions;

using DotNetNuke.Services.Scheduling;

using System;

// When installing the schedule in DNN use this full class and assembly name: DNNScheduledTask.DotNetNuke.MyTask, DNNScheduledTask

namespace DNNScheduledTask.DotNetNuke

{

    internal class MyTask: SchedulerClient

    {

        public MyTask(ScheduleHistoryItem objScheduleHistoryItem)

        {

            ScheduleHistoryItem = objScheduleHistoryItem;

        }

        public override void DoWork()

        {

            try

            {

                // add a note to record task being run   

                ScheduleHistoryItem.AddLogNote("<br/><strong>MyTask job was started!</strong>");

                // do some work

                SomeWork.TruncateEventLog();

                // add a note to record success   

                ScheduleHistoryItem.AddLogNote("<br/>");

                ScheduleHistoryItem.AddLogNote("<br/><strong>MyTask job ran successfully!</strong>");

                // report success to the scheduler framework

                ScheduleHistoryItem.Succeeded = true;

            }

            catch (Exception exc)

            {

                ScheduleHistoryItem.Succeeded = false;

                ScheduleHistoryItem.AddLogNote("EXCEPTION: " + exc);

                Errored(ref exc);

                Exceptions.LogException(exc);

            }

        }

    }

}

At DNNDevelopers, we possess extensive expertise in leveraging the functionality and features of DotNetNuke, including the implementation and development of scheduled tasks. Our team has a wealth of experience in executing scheduled tasks to address diverse business needs. Please do not hesitate to reach out to us if you have any queries or requirements related to developing scheduled tasks. We would be delighted to assist you in every possible way.

You may administer your website more effectively with the help of the DotNetNuke Scheduler, a potent tool. You may automate a variety of operations with its task scheduling features, from email sending to database upkeep. It is a crucial tool for any administrator of a DotNetNuke website because of its versatility, security, notifications, and logging features. We strongly advise that you give the Scheduler a try if you haven't already.

Users can handle scheduled tasks on their website with the help of the DotNetNuke Scheduler feature, which is a strong tool. By developing a class that inherits from the SchedulerClient base class and customizing the "DoWork" method, users can create unique scheduled jobs. For optimum efficiency, the Scheduler Mode property inside the host settings should be set to Timer Mode. Users can easily enable or disable scheduled jobs on their site as well as manage individual tasks by following the instructions provided in the Scheduler documentation. Complex business requirements can be managed flawlessly using the DotNetNuke Scheduler feature with the right planning and logging in place.

Rating
Comments

Name (required)

Email (required)

Website

SEND US YOUR REQUIREMENTS

To know more about our affordable services, contact us today or drop us a mail with the requirements at Jitendra@DnnDeveloper.In We will respond to you as soon as possible.