Newbie Question for MVC/VB.NET - Cannot start a simple job

I hope someone can help me as I am just going round in circles. I have correctly configured and set up Hangfire. I can navigate and view the dashboard but I just cannot for the life of me create a job. I have static module with a test method:

Module UpdateQueue
Public Class QueueSet
Public Function xSetDate() As String

Do something here

    End Function
End Class

End Module

I then try to create a job with various different attempts from linq expressions etc to the basic below:

BackgroundJob.Enqueue(Of QueueSet)(Function(x) x.xSetDate())

Whatever I try I always get the following error:

Expression body should be of type MethodCallExpression" & vbCrLf & “Parameter name: methodCall”. Once I have got past this, then also need to send parameters. I am sure I am just missing the point.

Any help gratefully received. I have spent a long time looking for a response and tried several suggestions from here. I just want to see that first job entered!

Thanks for anyones help.

Well, what would you know, I was going completely the wrong path. So if anyone out there is using VB.NET with Hangfire and as new as I to Hangfire you need to form your enqueue calls like this:

Hangfire.BackgroundJob.Enqueue(Sub() QueueSet.xSetDate())

Even though it is a function it still works with Sub. I have some lovely jobs running!

1 Like