Page 1 of 2

Jiwa Plugin Scheduler Service not doing anything

PostPosted: Thu Jan 24, 2019 4:37 pm
by DannyC
Hi,
I have the Jiwa Plugin Scheduler Service running & a few plugins have schedules entered to fire on given timing - one is every xx minutes.

When looking in Event Viewer, I can see that the service has started but it's not doing anything.
Is there a way to set the service to verbose mode or other way to rummage about to find why it's not firing the scheduled plugins? Everything is enabled (i.e the plugin, plus the schedule within) and the config file is correctly configured with the database name, server name etc.

version 7.2.

Re: Jiwa Plugin Scheduler Service not doing anything

PostPosted: Fri Jan 25, 2019 9:38 am
by Mike.Sheen
Hi Danny,

Add some event logging to various points to see what's happening.

If you don't have some code to do that - below is a method you can put in your class:
Code: Select all
Public Sub LogToEventLog(ByVal Message As String, ByVal EventLogEntryType As System.Diagnostics.EventLogEntryType)
   Dim Log As New System.Diagnostics.EventLog("Application")
   Log.Source = "Jiwa 7"
   Log.WriteEntry(Message, EventLogEntryType)
   Log.Close()
End Sub


Then the usage of this:
Code: Select all
LogToEventLog("Checkpoint #1", System.Diagnostics.EventLogEntryType.SuccessAudit)


I'd start with the Execute method of the ScheduledExecutionPlugin class - put a log entry there and see if it appears in the application log.
If it doesn't, then your plugin is not being executed - ensure it is enabled and try removing and re-adding the schedule.
Don't forget you'll need to restart the service after any changes to your plugin.

Mike

Re: Jiwa Plugin Scheduler Service not doing anything

PostPosted: Fri Jan 25, 2019 1:33 pm
by DannyC
The very first line of the Execute method is
Code: Select all
Plugin.Manager.LogEvent("Starting Batch Sales Order Process Run", EventLogEntryType.Information , 101, 1);


I have deleted the schedule & recreated.

I still don't get anything firing.

Re: Jiwa Plugin Scheduler Service not doing anything

PostPosted: Fri Jan 25, 2019 1:48 pm
by Mike.Sheen
Can you try logging not using Plugin.Manager.LogEvent and instead use the method provided.

The reason is that Plugin.Manager.LogEvent rather rudely swallows any exceptions occurring when attempting to log to the event log. Using the method I provided in my previous post will reveal if there is a problem writing to the event log.

Oh - and Plugin.Manager.LogEvent will only log anything if the system setting LogApplicationEvents is on.

Re: Jiwa Plugin Scheduler Service not doing anything

PostPosted: Fri Jan 25, 2019 2:36 pm
by DannyC
Thanks. Have added in your code.
I can confirm that it isn't firing. Nothing written into the event log.

Re: Jiwa Plugin Scheduler Service not doing anything

PostPosted: Fri Jan 25, 2019 2:39 pm
by Mike.Sheen
What about if you put a log entry in the OnServiceStart method and then restart the service?

Re: Jiwa Plugin Scheduler Service not doing anything

PostPosted: Fri Jan 25, 2019 3:10 pm
by DannyC
adding
LogToEventLog("Checkpoint #1", System.Diagnostics.EventLogEntryType.SuccessAudit);
in the OnServiceStart method is not firing either. Nothing in the event log.

Re: Jiwa Plugin Scheduler Service not doing anything

PostPosted: Fri Jan 25, 2019 3:11 pm
by Mike.Sheen
DannyC wrote:adding
LogToEventLog("Checkpoint #1", System.Diagnostics.EventLogEntryType.SuccessAudit);
in the OnServiceStart method is not firing either. Nothing in the event log.


Then either your plugin is not enabled, or it's in a different database to what the service is configured for.

EDIT: Also verify the PluginsToExclude and PluginsToInclude in the service config file - they affect which plugins to ignore.

Re: Jiwa Plugin Scheduler Service not doing anything

PostPosted: Fri Jan 25, 2019 3:56 pm
by DannyC
And therein lies the challenge. I can 100% confirm the plugin is enabled, and the schedule within that plugin is also enabled.

I can also confirm the config file is correct & pointing at the appropriate database.
I don't have any entries in PluginsToExclude/PluginsToInclude.

Re: Jiwa Plugin Scheduler Service not doing anything

PostPosted: Fri Jan 25, 2019 4:28 pm
by Scott.Pearce
Try this:

1. Create a fresh demo database on the same server
2. Disable all plugins in the database
3. Import the attached plugin and ensure it is enabled
4. Re-point the scheduler service to your fresh demo database
5. Start the plugin scheduler service

You should see this in the event log (each line is it's own event):

Code: Select all
[JiwaPluginSchedulerService, Version=7.2.0.0, Culture=neutral, PublicKeyToken=e30ce81e37f29c8c], [JiwaFinancials.Jiwa.JiwaPluginSchedulerService.JiwaPluginSchedulerService].[ServiceStart]Establishing Connection for: JiwaDemo (SessionID: 30861bc8-330b-46b6-8437-63502caf7837)


Code: Select all
Checkpoint #1 - Service Started


Code: Select all
Checkpoint #2 - Plugin executed.


Code: Select all
Service started successfully.



Then every minute thereafter you should see a new event appear:

Code: Select all
Checkpoint #2 - Plugin executed.