Clarification for VB.Net window service existing Code

recurring
Tags: #<Tag:0x00007f4997700818>

#1

Hi,

I am the new person of hangfire and went through the documents and i got understood the process and advantages and dashboard setting.

In that i found the window service with hangfire and executed succuessfully and able to the schedule the jobs in startup class.

My existing project have no startup class. do we need to create the new startup class or just include that configuration method alone.

this is my entry point class:

Imports Hangfire

<System.ComponentModel.DesignerCategory("")>
Public Class ServiceClass
Inherits DashServiceBase

Shared Sub Main()
    Dim svc As New ServiceClass
    With svc
        .ServiceName = "FileMergeService"  ' Optional - override service name (this will be overridden by the service installer)
        .ProgramName = "FileMergeService"       ' Optional - override program name if different than service name (used to get DistributionInfo)
        .InitialInterval = 5000                 ' Optional - override initial timer interval
        .Interval = 15000                       ' Optional - override timer interval
        .ServiceMain()                          ' This is always needed
    End With
End Sub

Public Overrides Sub Start()
    ' Code to start your service's process when the timer fires goes here.  DistributionInfo checking happens before this is called
    ' so there's no need to check that in your service.
    Dim ServiceProcess As TSSFileMergeBase
    Select Case ProjectDesc.Trim.ToLower

        Case "upmc", "upmcletters", "upmc letters"
            ServiceProcess = New TSSUPMCFileMerge

        Case Else  ' For now default to CBI 
            ServiceProcess = New TSSUPMCFileMerge
    End Select

    With ServiceProcess
        .ProjectID = ProjectID      ' DashServiceBase gets these for us, so pass them to our class
        .ProjectDesc = ProjectDesc  ' DashServiceBase gets these for us, so pass them to our class
    End With
    **RecurringJob.AddOrUpdate(Sub() ServiceProcess.Start(), Cron.Minutely)**
End Sub

End Class