Skip to content

Commit 79ff913

Browse files
committed
Fix config switch issue and update docs
1 parent d1dd353 commit 79ff913

File tree

12 files changed

+95
-48
lines changed

12 files changed

+95
-48
lines changed

docs-src/commands.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ paket add InEngine.Core
2828

2929
Adding a class that implements **InEngine.Core.ICommand** is the simplest way to create a command.
3030

31-
```csharp
31+
```c#
3232
using System;
3333
using InEngine.Core;
3434

@@ -48,7 +48,7 @@ namespace MyCommandPlugin
4848
Extending the **InEngine.Core.AbstractCommand** class adds extra functionality, like a logger, a progress bar, and the ability to schedule the command using the scheduler.
4949
Minimally, the Run method should be overridden.
5050

51-
```csharp
51+
```c#
5252
using System;
5353
using InEngine.Core;
5454

@@ -72,7 +72,7 @@ Create a class that implements **InEngine.Core.IOptions** in the same assembly a
7272
Add a VerbOptions attribute from the CommandLine namespace that defines the name of the command and optional help text.
7373
The help text can be auto-generated from the attribute or manually specified in the GetUsage method.
7474

75-
```csharp
75+
```c#
7676
using CommandLine;
7777
using CommandLine.Text;
7878
using InEngine.Core;
@@ -179,15 +179,15 @@ Copyright © Ethan Hann 2017
179179

180180
The **InEngine.Core.AbstractCommand** class provides some helper functions to output text to the console:
181181

182-
```csharp
182+
```c#
183183
IWrite Newline();
184184
IWrite Info(string val);
185185
IWrite Warning(string val);
186186
IWrite Error(string val);
187187
IWrite Line(string val);
188188
```
189189

190-
```csharp
190+
```c#
191191
public override CommandResult Run()
192192
{
193193
Info("Display some information");
@@ -196,13 +196,13 @@ public override CommandResult Run()
196196

197197
Display an error message, use the Error method.
198198

199-
```csharp
199+
```c#
200200
Error("Display some information");
201201
```
202202

203203
Display a warning message, use the Warning method.
204204

205-
```csharp
205+
```c#
206206
Error("Display some information");
207207
```
208208

@@ -214,7 +214,7 @@ Line("This is a plain line.");
214214

215215
The **InEngine.Core.AbstractCommand** class provides a Logger property. It implements the **NLog.ILogger** interface.
216216

217-
```csharp
217+
```c#
218218
public override CommandResult Run()
219219
{
220220
Logger.Trace("Sample trace message");
@@ -250,7 +250,7 @@ Setup an [NLog configuration](https://github.com/NLog/NLog/wiki/Tutorial#configu
250250

251251
The **InEngine.Core.AbstractCommand** class provides a ProgressBar property. This is how it is used.
252252

253-
```csharp
253+
```c#
254254
public override CommandResult Run()
255255
{
256256
// Define the ticks (aka steps) for the command...

docs-src/configuration.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Configuration
2+
3+
Configuration is accomplished by modifying the appsettings.json file that comes with the InEngine.NET binary distribution.
4+
5+
6+
```json
7+
{
8+
"InEngine": {
9+
"Queue": {
10+
"QueueName": "InEngine:Queue",
11+
"RedisHost": "localhost",
12+
"RedisPort": 6379,
13+
"RedisDb": 0,
14+
"RedisPassword": ""
15+
}
16+
}
17+
}
18+
```
19+
20+
The -c, --configuration argument can also be used to specify an alternate configuration file.
21+
22+
23+
24+

docs-src/css/style.css

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +0,0 @@
1-
2-
.navbar-default {
3-
background: #0a69fa;
4-
}
5-
6-
.navbar-default .navbar-nav > .active > a,
7-
.navbar-default .navbar-nav > .active > a:hover,
8-
.navbar-default .navbar-nav > .active > a:focus {
9-
background-color: #0a69fa;
10-
}
11-
12-
.navbar-default .navbar-nav > li > a:hover,
13-
.navbar-default .navbar-nav > li > a:focus {
14-
background-color: #0a69fa;
15-
}
16-
17-
a,
18-
a:hover,
19-
a:focus {
20-
color: #2200CC;
21-
}
22-
File renamed without changes.

docs-src/index.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
# InEngine.NET
2-
31
InEngine.NET allows commands to be queued, scheduled, and run directly.
42

5-
6-
## How to Get Started
7-
8-
Get started by reading up on [commands](commands).
3+
Get started by reading up on [commands](commands), then [scheduling](scheduling) and [queuing](queuing).

docs-src/queuing.md

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ It is highly recommended to <a href="https://redis.io/topics/security#authentica
2727

2828
[Commands](commands) can be published programmatically with the **InEngine.Core.Queue.Broker** class:
2929

30-
```csharp
30+
```c#
3131
Broker.Make().Publish(new MyCommand());
3232
```
3333

@@ -51,13 +51,13 @@ inengine.exe -pInEngine.Core queue:publish --command-assembly=InEngine.Core.dll
5151
#### Programmatically
5252
Consuming a command is also accomplished with the Broker class:
5353

54-
```csharp
54+
```c#
5555
Broker.Make().Consume();
5656
```
5757

5858
Both methods take an optional second argument to indicate if the secondary queue should be used instead of the primary queue.
5959

60-
```csharp
60+
```c#
6161
// Uses secondary queue.
6262
Broker.Make().Consume(true);
6363
```
@@ -70,7 +70,7 @@ Commands can be consumed from the command line as well with this simple command:
7070
inengine.exe -pInEngine.Core queue:consume
7171
```
7272

73-
use the **--secondary** switch to consume the secondary queue instead of the primary queue:
73+
Use the **--secondary** switch to consume the secondary queue instead of the primary queue:
7474

7575
```bash
7676
inengine.exe -pInEngine.Core queue:consume --secondary
@@ -80,3 +80,18 @@ inengine.exe -pInEngine.Core queue:consume --secondary
8080

8181
The InEngine scheduler is needed to consume queued messages in the background.
8282
There are a variety of [ways to run the scheduler](scheduling/#running-the-scheduler).
83+
84+
85+
## Primary and Secondary Queue
86+
87+
Other than the fact that the primary queue is used by default, there is difference between the primary and secondary queues.
88+
However, it is often desirable to have more than 1 queue.
89+
For example, long running jobs might be sent to the secondary queue,
90+
while jobs that are expected to finish after only a few moments are sent to the primary queue.
91+
92+
What about 3, 4, 900 queues? This gets to be a pain to manage and, practically speaking, is probably unnecessary.
93+
If it is desirable, different [configuration files](configuration) can be used to run multiple instances of InEngine.NET.
94+
95+
96+
97+

docs-src/scheduling.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
A job schedule is created by adding a class to your plugin assembly that implements the **InEngine.Core.Jobs** interface.
88

9-
```csharp
9+
```c#
1010

1111
using System;
1212
using Quartz;
@@ -26,7 +26,7 @@ namespace MyCommandPlugin
2626
This class is automatically discovered by the InEngine.NET scheduler.
2727
It will call the Jobs.Schedule method with an initialized Quartz.NET scheduler object.
2828

29-
```csharp
29+
```c#
3030
using System;
3131
using Quartz;
3232

mkdocs.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,36 @@
11
docs_dir: docs-src
22
site_dir: docs
33
site_name: InEngine.NET
4+
repo_name: 'InEngine.NET'
45
repo_url: https://github.com/InEngine-NET/InEngine.NET
56
site_author: Ethan Hann
67
copyright: © 2017 - Ethan Hann
8+
edit_uri: ''
79

810
pages:
911
- Getting Started: 'index.md'
1012
- Documentation:
1113
- commands.md
1214
- scheduling.md
1315
- queuing.md
16+
- configuration.md
1417

1518
extra_css:
1619
- css/style.css
20+
21+
theme:
22+
name: 'material'
23+
favicon: 'images/favicon.ico'
24+
logo: 'images/inengine-logo-32-alt.png'
25+
palette:
26+
primary: 'blue'
27+
accent: 'blue'
28+
feature:
29+
tabs: false
30+
31+
markdown_extensions:
32+
- admonition
33+
- codehilite:
34+
guess_lang: false
35+
- toc:
36+
permalink: true

src/InEngine.Core/InEngineSettings.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@ namespace InEngine.Core
77
public class InEngineSettings
88
{
99
public static string BasePath { get; set; } = Directory.GetCurrentDirectory();
10+
public static string ConfigurationFile { get; set; } = "appsettings.json";
1011
public QueueSettings Queue { get; set; }
1112

1213
public static InEngineSettings Make()
1314
{
1415
var inEngineSettings = new InEngineSettings();
1516
new ConfigurationBuilder()
1617
.SetBasePath(BasePath)
17-
.AddJsonFile("appsettings.json")
18+
.AddJsonFile(ConfigurationFile)
1819
.Build()
1920
.GetSection("InEngine")
2021
.Bind(inEngineSettings);

src/InEngine.Core/Plugin.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,14 @@ public Plugin(Assembly assembly)
2121

2222
public static Plugin LoadFrom(string assemblyPath)
2323
{
24+
var path = Path.Combine(InEngineSettings.BasePath, assemblyPath);
2425
try
2526
{
26-
return new Plugin(Assembly.LoadFrom(Path.Combine(InEngineSettings.BasePath, assemblyPath)));
27+
return new Plugin(Assembly.LoadFrom(path));
2728
}
2829
catch (Exception exception)
2930
{
30-
throw new PluginNotFoundException($"Could not load plugin: {assemblyPath}", exception);
31+
throw new PluginNotFoundException($"Plugin not found at {path}", exception);
3132
}
3233
}
3334

0 commit comments

Comments
 (0)