Solved

DNN Core Scheduler - Code?

Posted on 2009-05-11
12
401 Views
Last Modified: 2012-05-06
Hi Fellow DNN users,

I am trying to get the DNN scheduler to run, and I am struggling.

I have copied the code from http://www.wwwcoder.com/tabid/68/type/art/parentid/224/site/6401/default.aspx however it doesn't just work.

I am not getting any history happening, and the Job I have created fSetWindow, adds a row to a table, but it is not doing anything either.
I am not getting any exception errors, I don't believe it is being hit at all.

Project Name:WWT_DNN
File Name: WWT_Schedule
DLL Name: WWT_DNN.dll

Code Below

See attached for DNN Scheduler settings
Imports System.Configuration

Imports DotNetNuke

Imports System.Web

Imports WWT_dnn_Functions.Functions
 

Namespace WWT_DNN
 

    Public Class WWT_Schedule
 

        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

                For i = 0 To 1000000000
 

                Next
 

                fSetWindow(strType:="Send", UserID:=1, iCreditsHold:=0, CodeID:=1, MobileID:=1, iMins:=180)
 

                Me.ScheduleHistoryItem.AddLogNote("RSS Incremental Build Suceeded")

                Me.ScheduleHistoryItem.Succeeded = True

            Catch ex As Exception

                Me.ScheduleHistoryItem.Succeeded = False

                Me.ScheduleHistoryItem.AddLogNote("Index build failed. " & ex.ToString)

                Me.Errored(ex)

            End Try
 

        End Sub
 

    End Class
 

End Namespace

Open in new window

DNN-SchedulerSettings.png
0
Comment
Question by:Craig Lambie
  • 5
  • 5
12 Comments
 
LVL 8

Expert Comment

by:paololabe
ID: 24392967
To reproduce your enviroment I would like to know the dnn version you are using

Paolo.
0
 
LVL 8

Expert Comment

by:paololabe
ID: 24392984
Another question have you checked event viewer to see if something is going wrong in your class ?

Paolo
0
 
LVL 1

Author Comment

by:Craig Lambie
ID: 24393619
Hi,

DNN v 4.9.1

I am not sure how to view event viewer? Can you explain that a little?
I have had a look at Event Viewer, I can't find anything to do with it?

Thanks

C

0
 
LVL 8

Expert Comment

by:paololabe
ID: 24393762
admin -> event viewer

Just to be sure, what have you on host settings "Scheduler mode", you can see it by HOST->HOST settings, open section "OTHER SETTINGS"
0
 
LVL 1

Author Comment

by:Craig Lambie
ID: 24401133
Hi
I have no errors in the event viewer in DNN.

Scheduler Mode is set to "Request Mode" in Host Settings>Other Settings
The other option is "Timer Method"

C
0
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 
LVL 1

Author Comment

by:Craig Lambie
ID: 24431053
Hi Paulo,
Any Ideas??
0
 
LVL 8

Accepted Solution

by:
paololabe earned 500 total points
ID: 24431320
I've done a test on my dnn installation, I used your code with a little changes to avoid importing library WWT_dnn_Functions.Functions,
everithing seems to work, the only difference is that in the full class name I wrote "WWT_DNN.WWT_Schedule", without specifying the assembly because I used a .vb in AppCodde folder

i suppose you haven't nothing in history, isn't it ?

Paolo


Imports System.Configuration

Imports DotNetNuke

Imports System.Web

'Imports WWT_dnn_Functions.Functions
 

Namespace WWT_DNN
 

    Public Class WWT_Schedule
 

        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()

            Dim i As Integer
 

            Try

                For i = 0 To 1000000000
 

                Next
 

                'fSetWindow(strType:="Send", UserID:=1, iCreditsHold:=0, CodeID:=1, MobileID:=1, iMins:=180)
 

                Me.ScheduleHistoryItem.AddLogNote("RSS Incremental Build Suceeded")

                Me.ScheduleHistoryItem.Succeeded = True

            Catch ex As Exception

                Me.ScheduleHistoryItem.Succeeded = False

                Me.ScheduleHistoryItem.AddLogNote("Index build failed. " & ex.ToString)

                Me.Errored(ex)

            End Try
 

        End Sub
 

    End Class
 

End Namespace

Open in new window

0
 
LVL 1

Author Comment

by:Craig Lambie
ID: 24437707
Hi Paolo,

Thanks for that.  I copied the .vb into the AppCode folder, and recreated the Schedule Item, without the assembly name, and wackydo.... it worked.
I now have schedule history, and the job I have (updating a Db table) is working too, every minute.
You where right, I was not getting any history at all before.
Thanks.

Why does it not work as specified in the websites where I found this code? Any Ideas?

0
 
LVL 8

Expert Comment

by:paololabe
ID: 24438158
I think could be a namespace or assembly name issue, but if you have a WWT_DNN.dll file on your bin folder I don't see any mistake, or could be caused by the context in which method DoWork is called, try to change to "timer mode" to execute outside the user request context.
0
 
LVL 1

Author Comment

by:Craig Lambie
ID: 24438190
I tried the timer method already, that didn't work either.

Thanks for all your help, appreciate it.

C
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
Read about how to choose the best possible content marketing agency to suit your needs. Content marketing has become an integral part of running a successful tech business, so it is wise to be informed.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now