Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Scheduler class is not calledScheduler class is not called
Previous
 
Next
New Post
5/16/2008 5:05 PM
 

 

Hi Everyone!

I need some help with the scheduler! I can't get it to run. I created a class simular to the sample in the documentation!

That part went well but the scheduler is not running. I will not get any error messages and no history exist.

Obviosly the class that I wrote is not called by the scheduler! Is there something I am missing and how can I debug the scheduler?

My Class:

-------------------------------------------------------

Imports Microsoft.VisualBasic
Imports System.IO

Namespace DotNetNuke.Modules.MoistureSensitiveItems

    Public Class AutoEmailNotification
        Inherits DotNetNuke.Services.Scheduling.SchedulerClient
        Public Sub New(ByVal objScheduleHistoryItem As DotNetNuke.Services.Scheduling.ScheduleHistoryItem)
            MyBase.New()
            Me.ScheduleHistoryItem = objScheduleHistoryItem
        End Sub

        Public Overrides Sub DoWork()
            Try
                Me.Progressing()

                MSINotification()

                Me.ScheduleHistoryItem.Succeeded = True

                Me.ScheduleHistoryItem.AddLogNote("File updated")

            Catch ex As Exception

                Me.ScheduleHistoryItem.Succeeded = False

                Me.ScheduleHistoryItem.AddLogNote("EXEPTION: " + ex.ToString)

                'nootification that we have errored
                Me.Errored(ex)

                'Log the Exception
                LogException(ex)
            End Try
        End Sub

        Private Sub MSINotification()
            'create filename
            Me.Status = "Updating file"
            Dim FILENAME As String = MSI_Global.MSI_FILEPATH_TEMPFOLDER & _
                                     DateTime.Now.Year.ToString() & _
                                     DateTime.Now.Month.ToString() & _
                                     DateTime.Now.Day.ToString() & _
                                     DateTime.Now.Hour.ToString() & _
                                     DateTime.Now.Minute.ToString() & _
                                     DateTime.Now.Second.ToString() & ".txt"

            'create writestream
            Dim objStreamWriter As StreamWriter
            objStreamWriter = File.AppendText(FILENAME)

            objStreamWriter.WriteLine("I'am running -- " + DateTime.Now.ToString)

            'Close the stream
            objStreamWriter.Close()
            Me.Status = "Updating complete"
            Me.ScheduleHistoryItem.AddLogNote("Add new timestamp to file")
            Me.ScheduleHistoryItem.Succeeded = True
        End Sub
    End Class
End Namespace

 
New Post
5/22/2008 7:50 AM
 

Hi Zoran,

I have exactly the same problem - no events in the event viewer, no exceptions anywhere, no history, nothing. Did you ever find out any more about how to investigate this further?

Cheers,

Paul

 
New Post
5/22/2008 11:01 AM
 

 

Hi Zoran, again, and to answer my own question, this is what I did...

Suspecting that my SchedulerClient class wasn't being constructed at all, I copied some of the code out of the source for DNN Scheduler, and pasted it into the code behind a button on a dummy test module:

Stop
'''''''''''''''''''''''''''''''''''''''''''''''''''
Dim t As Type = System.Web.Compilation.BuildManager.GetType("Idonix.DNN.Modules.EC.MyriadMembership.MyriadMembershipImporter", True, True)
Dim param(0) As DotNetNuke.Services.Scheduling.ScheduleHistoryItem
param(0) = New DotNetNuke.Services.Scheduling.ScheduleHistoryItem
'''''''''''''''''''''''''''''''''''''''''''''''''''
'Get the constructor for the Class
'''''''''''''''''''''''''''''''''''''''''''''''''''
Dim types(0) As Type
types(0) = GetType(DotNetNuke.Services.Scheduling.ScheduleHistoryItem)
Dim objConstructor As System.Reflection.ConstructorInfo
objConstructor = t.GetConstructor(types)
'''''''''''''''''''''''''''''''''''''''''''''''''''
'Return an instance of the class as an object
'''''''''''''''''''''''''''''''''''''''''''''''''''
Dim C as DotNetNuke.Services.Scheduling.SchedulerClient = CType(objConstructor.Invoke(param), DotNetNuke.Services.Scheduling.SchedulerClient)

 

Note the 'stop' at the top that makes debugging/step through of the code possible, so long as the site is on your dev. machine.

Having done this and stepped through the code, I discovered firstly that I had the wrongly formatted AssemblyName/TypeName thing, but being able to experiment in the Immediate window of Visual Studio made it easy to fiddle until it came right.

I then discovered that my SchedulerClient class's constructor 'Public Sub New(item as ScheduleHistoryItem)' was missing (oops!), and so the objConstructor above was returning nothing. Having fixed that up all came good, and my scheduled job took off as expected.

If you put a 'Stop' line in the top of your DoWork() sub, you'll also hit the debugger when the code is at last called.

I hope this is some help.

Cheers,

Paul.

 

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Scheduler class is not calledScheduler class is not called


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out