You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs-src/scheduling.md
+56Lines changed: 56 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,62 @@
2
2
3
3
[Commands](commands) can be scheduled to run by leveraging the InEngineScheduler.exe program, available as a download from a recent [release](https://github.com/InEngine-NET/InEngine.NET/releases).
4
4
5
+
## Scheduling a Command
6
+
7
+
A job schedule is created by adding a class to your plugin assembly that implements the **InEngine.Core.Jobs** interface.
8
+
9
+
```csharp
10
+
11
+
usingSystem;
12
+
usingQuartz;
13
+
14
+
namespaceMyCommandPlugin
15
+
{
16
+
publicclassJobs : IJobs
17
+
{
18
+
publicvoidSchedule(ISchedulerscheduler)
19
+
{
20
+
// Schedule some jobs
21
+
}
22
+
}
23
+
}
24
+
```
25
+
26
+
This class is automatically discovered by the InEngine.NET scheduler.
27
+
It will call the Jobs.Schedule method with an initialized Quartz.NET scheduler object.
28
+
29
+
```csharp
30
+
usingSystem;
31
+
usingQuartz;
32
+
usingInEngine.Core.Queue.Commands;
33
+
usingSystem.Collections.Generic;
34
+
usingSystem.Linq;
35
+
36
+
namespaceInEngine.Core.Queue
37
+
{
38
+
publicclassJobs : IJobs
39
+
{
40
+
publicvoidSchedule(ISchedulerscheduler)
41
+
{
42
+
varmyCommand=newMyCommand();
43
+
44
+
// Generate a schedulable job with the command
45
+
varjob=myCommand.MakeTriggerBuilder().Build();
46
+
47
+
// Generate a trigger for the job, and set its schedule to every 10 seconds.
Copy file name to clipboardExpand all lines: docs/mkdocs/search_index.json
+6-1Lines changed: 6 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -62,14 +62,19 @@
62
62
},
63
63
{
64
64
"location": "/scheduling/",
65
-
"text": "Scheduling\n\n\nCommands\n can be scheduled to run by leveraging the InEngineScheduler.exe program, available as a download from a recent \nrelease\n.\n\n\nRunning the Scheduler\n\n\nManually from the CLI\n\n\nRunning the scheduler from the CommandLine is useful for debugging or local development. Simply run \nInEngineScheduler.exe\n from the command line.\n\n\nInEngineScheduler.exe\n\n\n\n\nIt can also be run on Mac/Linux with Mono.\n\n\nmono InEngineScheduler.exe\n\n\n\n\nOn Windows as a Service\n\n\nInstalling\n\n\nRun the Install.ps1 PowerShell script in the scheduler directory to install the scheduler in place. The script needs to be run as an administrator. The script will register the service at the location where the script is run. \n\n\nps Install.ps1\n\n\n\n\nUninstalling\n\n\nSimply run the \nUninstall.ps1\n script with elevated permissions to unregister the service.\n\n\nps Uninstall.ps1\n\n\n\n\nOn Linux with Supervisor\n\n\nSupervisor is a process control system for Linux. It has extensive \ndocumentation\n, but the following should be enough to get started.\n\n\nInstalling Supervisor\n\n\nThis command installs Supervisor on Ubuntu:\n\n\nsudo apt-get install supervisor\n\n\n\n\nConfiguring Supervisor\n\n\nSupervisor configuration files are stored in the \n/etc/supervisor/conf.d\n directory. Multiple files can be created in this directory to specify different programs, or multiple instances of the same program, for Supervisor to monitor. Copy this sample config into a file called \n/etc/supervisor/conf.d/inengine-scheduler.conf\n. \n\n\n[program:inengine-scheudler]\nprocess_name=%(program_name)s_%(process_num)02d\ndirectory=/path/to/scheduler\ncommand=mono InEngineScheduler.exe\nautostart=true\nautorestart=true\nuser=InEngine\nnumprocs=1\nredirect_stderr=true\nstdout_logfile=./scheduler.log\n\n\n\n\nStarting Supervisor\n\n\nWhenever a configuration change happens to files in the Supervisor config files, Supervisor needs to be instructed to reload its configuration.\n\n\nsudo supervisorctl reread\nsudo supervisorctl update\n\n\n\n\nNow, simply start the InEngine Scheduler.\n\n\nsudo supervisorctl start inengine-scheduler:*",
65
+
"text": "Scheduling\n\n\nCommands\n can be scheduled to run by leveraging the InEngineScheduler.exe program, available as a download from a recent \nrelease\n.\n\n\nScheduling a Command\n\n\nA job schedule is created by adding a class to your plugin assembly that implements the \nInEngine.Core.Jobs\n interface.\n\n\n\nusing System;\nusing Quartz;\n\nnamespace MyCommandPlugin\n{\n public class Jobs : IJobs\n {\n public void Schedule(IScheduler scheduler)\n {\n // Schedule some jobs\n }\n }\n}\n\n\n\n\nThis class is automatically discovered by the InEngine.NET scheduler.\nIt will call the Jobs.Schedule method with an initialized Quartz.NET scheduler object.\n\n\nusing System;\nusing Quartz;\nusing InEngine.Core.Queue.Commands;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace InEngine.Core.Queue\n{\n public class Jobs : IJobs\n {\n public void Schedule(IScheduler scheduler)\n {\n var myCommand = new MyCommand();\n\n // Generate a schedulable job with the command\n var job = myCommand.MakeTriggerBuilder().Build();\n\n // Generate a trigger for the job, and set its schedule to every 10 seconds.\n var trigger = myCommand.MakeTriggerBuilder().Build()\n .StartNow()\n .WithSimpleSchedule(x =\n x.WithIntervalInSeconds(10).RepeatForever())\n .Build();\n\n // Register the job and trigger with the scheduler\n scheduler.ScheduleJob(job, trigger);\n }\n }\n}\n\n\n\n\n\nRunning the Scheduler\n\n\nManually from the CLI\n\n\nRunning the scheduler from the CommandLine is useful for debugging or local development. Simply run \nInEngineScheduler.exe\n from the command line.\n\n\nInEngineScheduler.exe\n\n\n\n\nIt can also be run on Mac/Linux with Mono.\n\n\nmono InEngineScheduler.exe\n\n\n\n\nOn Windows as a Service\n\n\nInstalling\n\n\nRun the Install.ps1 PowerShell script in the scheduler directory to install the scheduler in place. The script needs to be run as an administrator. The script will register the service at the location where the script is run. \n\n\nps Install.ps1\n\n\n\n\nUninstalling\n\n\nSimply run the \nUninstall.ps1\n script with elevated permissions to unregister the service.\n\n\nps Uninstall.ps1\n\n\n\n\nOn Linux with Supervisor\n\n\nSupervisor is a process control system for Linux. It has extensive \ndocumentation\n, but the following should be enough to get started.\n\n\nInstalling Supervisor\n\n\nThis command installs Supervisor on Ubuntu:\n\n\nsudo apt-get install supervisor\n\n\n\n\nConfiguring Supervisor\n\n\nSupervisor configuration files are stored in the \n/etc/supervisor/conf.d\n directory. Multiple files can be created in this directory to specify different programs, or multiple instances of the same program, for Supervisor to monitor. Copy this sample config into a file called \n/etc/supervisor/conf.d/inengine-scheduler.conf\n. \n\n\n[program:inengine-scheudler]\nprocess_name=%(program_name)s_%(process_num)02d\ndirectory=/path/to/scheduler\ncommand=mono InEngineScheduler.exe\nautostart=true\nautorestart=true\nuser=InEngine\nnumprocs=1\nredirect_stderr=true\nstdout_logfile=./scheduler.log\n\n\n\n\nStarting Supervisor\n\n\nWhenever a configuration change happens to files in the Supervisor config files, Supervisor needs to be instructed to reload its configuration.\n\n\nsudo supervisorctl reread\nsudo supervisorctl update\n\n\n\n\nNow, simply start the InEngine Scheduler.\n\n\nsudo supervisorctl start inengine-scheduler:*",
66
66
"title": "Scheduling"
67
67
},
68
68
{
69
69
"location": "/scheduling/#scheduling",
70
70
"text": "Commands can be scheduled to run by leveraging the InEngineScheduler.exe program, available as a download from a recent release .",
71
71
"title": "Scheduling"
72
72
},
73
+
{
74
+
"location": "/scheduling/#scheduling-a-command",
75
+
"text": "A job schedule is created by adding a class to your plugin assembly that implements the InEngine.Core.Jobs interface. \nusing System;\nusing Quartz;\n\nnamespace MyCommandPlugin\n{\n public class Jobs : IJobs\n {\n public void Schedule(IScheduler scheduler)\n {\n // Schedule some jobs\n }\n }\n} This class is automatically discovered by the InEngine.NET scheduler.\nIt will call the Jobs.Schedule method with an initialized Quartz.NET scheduler object. using System;\nusing Quartz;\nusing InEngine.Core.Queue.Commands;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace InEngine.Core.Queue\n{\n public class Jobs : IJobs\n {\n public void Schedule(IScheduler scheduler)\n {\n var myCommand = new MyCommand();\n\n // Generate a schedulable job with the command\n var job = myCommand.MakeTriggerBuilder().Build();\n\n // Generate a trigger for the job, and set its schedule to every 10 seconds.\n var trigger = myCommand.MakeTriggerBuilder().Build()\n .StartNow()\n .WithSimpleSchedule(x = x.WithIntervalInSeconds(10).RepeatForever())\n .Build();\n\n // Register the job and trigger with the scheduler\n scheduler.ScheduleJob(job, trigger);\n }\n }\n}",
<li><ahref="#scheduling-a-command">Scheduling a Command</a></li>
101
102
<li><ahref="#running-the-scheduler">Running the Scheduler</a></li>
102
103
</ul>
103
104
</div></div>
104
105
<divclass="col-md-9" role="main">
105
106
106
107
<h1id="scheduling">Scheduling</h1>
107
108
<p><ahref="../commands">Commands</a> can be scheduled to run by leveraging the InEngineScheduler.exe program, available as a download from a recent <ahref="https://github.com/InEngine-NET/InEngine.NET/releases">release</a>.</p>
109
+
<h2id="scheduling-a-command">Scheduling a Command</h2>
110
+
<p>A job schedule is created by adding a class to your plugin assembly that implements the <strong>InEngine.Core.Jobs</strong> interface.</p>
111
+
<pre><codeclass="csharp">
112
+
using System;
113
+
using Quartz;
114
+
115
+
namespace MyCommandPlugin
116
+
{
117
+
public class Jobs : IJobs
118
+
{
119
+
public void Schedule(IScheduler scheduler)
120
+
{
121
+
// Schedule some jobs
122
+
}
123
+
}
124
+
}
125
+
</code></pre>
126
+
127
+
<p>This class is automatically discovered by the InEngine.NET scheduler.
128
+
It will call the Jobs.Schedule method with an initialized Quartz.NET scheduler object.</p>
129
+
<pre><codeclass="csharp">using System;
130
+
using Quartz;
131
+
using InEngine.Core.Queue.Commands;
132
+
using System.Collections.Generic;
133
+
using System.Linq;
134
+
135
+
namespace InEngine.Core.Queue
136
+
{
137
+
public class Jobs : IJobs
138
+
{
139
+
public void Schedule(IScheduler scheduler)
140
+
{
141
+
var myCommand = new MyCommand();
142
+
143
+
// Generate a schedulable job with the command
144
+
var job = myCommand.MakeTriggerBuilder().Build();
145
+
146
+
// Generate a trigger for the job, and set its schedule to every 10 seconds.
147
+
var trigger = myCommand.MakeTriggerBuilder().Build()
// Register the job and trigger with the scheduler
153
+
scheduler.ScheduleJob(job, trigger);
154
+
}
155
+
}
156
+
}
157
+
158
+
</code></pre>
159
+
108
160
<h2id="running-the-scheduler">Running the Scheduler</h2>
109
161
<h3id="manually-from-the-cli">Manually from the CLI</h3>
110
162
<p>Running the scheduler from the CommandLine is useful for debugging or local development. Simply run <em>InEngineScheduler.exe</em> from the command line.</p>
0 commit comments