Skip to content

Commit 1c99d4d

Browse files
committed
Update docs
1 parent 17f832a commit 1c99d4d

File tree

3 files changed

+88
-16
lines changed

3 files changed

+88
-16
lines changed

docs-src/configuration.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ Configuration is accomplished by modifying the appsettings.json file that comes
1313
"UseCompression": false,
1414
"PrimaryQueueConsumers": 16,
1515
"SecondaryQueueConsumers": 4,
16-
"QueueName": "InEngine:Queue",
16+
"QueueDriver": "redis",
17+
"QueueName": "InEngineQueue",
1718
"RedisHost": "localhost",
1819
"RedisPort": 6379,
1920
"RedisDb": 0,
@@ -39,6 +40,7 @@ Configuration is accomplished by modifying the appsettings.json file that comes
3940
| UseCompression | bool | A situation performance optimization that compresses queued messages. |
4041
| PrimaryQueueConsumers | string | The number of consumers to schedule for the secondary queue. |
4142
| SecondaryQueueConsumers | string | The number of consumers to schedule for the secondary queue. |
43+
| QueueDriver | string | The driver to use to interact with a queue data store. |
4244
| QueueName | string | The base name of the queue, used to form the Redis Queue keys. |
4345
| RedisHost | string | The Redis hostname to connect to. |
4446
| RedisPort | integer | Redis's port. |

docs-src/index.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,16 @@ InEngine.NET allows commands to be [queued](queuing), [scheduled](scheduling), a
55
InEngine.NET uses a plugin system to dynamically load .NET assemblies and execute code.
66
It also has a built-in command for launching external non-.NET programs.
77

8-
Get started by pulling the latest binaries from the [latest release](https://github.com/InEngine-NET/InEngine.NET/releases) on GitHub.
8+
Get started by pulling the binaries from the [latest release](https://github.com/InEngine-NET/InEngine.NET/releases) on GitHub.
99

10-
Then run a [command](commands):
10+
Then run a command the **echo** command from the core plugin:
1111

1212
```bash
1313
inengine.exe -pInEngine.Core echo --text"Hello, world"
1414
```
1515
Or if you\'re a Linux or Mac OS X fan (like me!), use the **inengine** shell script ([Mono](http://www.mono-project.com/download/) required.):
1616

1717
```bash
18-
# or if you\'re a Linux fan like me...
19-
2018
inengine -pInEngine.Core echo --text"Hello, world"
2119
```
2220

@@ -32,7 +30,11 @@ Now run a command in a container:
3230
docker run --rm inengine -pInEngine.Core echo --text"Hello, world"
3331
```
3432

35-
Want to queue our example echo command to run in (possibly) another server?
33+
## How does queueing work?
34+
35+
There are a lot of [queuing](queuing) features, but this is the gist...
36+
37+
Want to queue our example echo command to run in the background or possibly on another server?
3638

3739
Use the core plugin's **queue:publish** command:
3840

@@ -48,11 +50,11 @@ Use the core plugin's **queue:consume** command of course:
4850
inengine.exe -pInEngine.Core queue:consume
4951
```
5052

51-
But what if I want to run some non-.NET code?
53+
## How do I run non-.NET commands?
5254

53-
Use the core plugin's **proc** command to execute any program you like.
55+
There is a special **proc** command in the core plugin that allows for the execution of any program you can run at the command line.
5456

55-
Create a hello world python script called **helloworld.py**:
57+
For example, create a python script called **helloworld.py** that contains this:
5658

5759
```python
5860
print 'Hello, world!'

docs-src/queuing.md

Lines changed: 75 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,22 @@
22

33
InEngine.NET's queue functionality allows for commands to be run in the background with a simple publish/consume model.
44

5-
## Prerequisites
5+
## Queue Drivers
66

7-
Redis is required to use the InEngine.NET queue feature.
8-
It can be installed on Ubuntu with this command:
7+
To make use of queue features, a queue driver must be specified in [appsettings.json](configuration).
8+
These are the available drivers...
9+
10+
### File
11+
12+
The file driver writes queued messages to the file system.
13+
It is useful for testing and development, but probably not suitable for production.
14+
15+
### Redis
16+
17+
Redis is suitable for production use.
18+
InEngine.NET utilizes Redis' durable queue features which mean messages will not be lost if InEngine.NET unexpectedly fails.
19+
20+
Redis can be installed on Ubuntu with this command:
921

1022
```bash
1123
sudo apt-get install redis-server
@@ -19,24 +31,80 @@ sudo service redis start
1931

2032
<div class="alert alert-info">
2133
It is highly recommended to <a href="https://redis.io/topics/security#authentication-feature">set a password</a> for Redis.
22-
</div>
34+
</div>
35+
36+
### Sync
37+
38+
The sync driver causes the publish command to run a published command synchronously.
39+
All other queue commands and methods are not supported and will throw an exception if called.
40+
This driver can be useful for plugin development and testing.
2341

2442
## Publishing Commands
2543

26-
### From Code
44+
### With C# Classes
2745

2846
[Commands](commands) can be published programmatically with the **InEngine.Core.Queuing.Queue** class:
2947

3048
```c#
3149
Queue.Make().Publish(new MyCommand());
3250
```
3351

34-
Or publish to the secondary queue:
52+
Or publish to the secondary queue by passing true to the Make method:
3553

3654
```c#
3755
Queue.Make(true).Publish(new MyCommand());
3856
```
3957

58+
!!! note "Do I have to use Queue.Make()?"
59+
Queue.Make() is a factory method that autoloads the queue settings from appsettings.json, creates the appropriate queue driver, and returns an instance of Queue.
60+
You can create your own Queue object an initialize it if you want.
61+
At the very least you can assign the object returned by Queue.Make() to a local variable or load it into a DI container for later use.
62+
63+
### With Lambda Expressions
64+
65+
Lambda expressions, aka anonymous functions, can be queued.
66+
The disadvantage to queuing lambdas is that the helpful functionality available in **InEngine.Core.AbstractCommand** is not available.
67+
68+
This is how you queue a lambda:
69+
70+
```c#
71+
Queue.Make().Publish(() => Console.WriteLine("Hello, world!"));
72+
```
73+
74+
Here is a neat shortcut for commands without parameters:
75+
76+
```c#
77+
Queue.Make().Publish(() => Foo.Bar());
78+
// Can be rewritten as...
79+
Queue.Make().Publish(Foo.Bar);
80+
```
81+
82+
### Sequentially In a Chain
83+
84+
Chained commands run in the order specified.
85+
This is useful for when order matters.
86+
87+
Also, if one command in the chain fails, then subsequent commands are not run at all.
88+
This affords the opportunity to add additional code that records which command failed, then resuming the command chain where it left off.
89+
90+
Here is a an example of how to chain an imaginary file transfer command together:
91+
92+
```c#
93+
Subject.Publish(new[] {
94+
new MyFileTransfer(filePath1),
95+
new MyFileTransfer(filePath2),
96+
new MyFileTransfer(filePath3),
97+
});
98+
```
99+
100+
101+
```c#
102+
Subject.Publish(new List<AbstractCommand>() {
103+
new AlwaysSucceed(),
104+
new Echo() { VerbatimText = "Hello, world!"},
105+
});
106+
```
107+
40108
### From the Command Line
41109

42110
Commands can be published from the command line as well.
@@ -104,7 +172,7 @@ The **queue:length** command shows a quick summary of pending, in-progress, and
104172
inengine.exe -pInEngine.Core queue:length
105173
```
106174

107-
### Peek at Commands
175+
### Peek at Queued Commands
108176

109177
The **queue:peek** command allows for queued commands to be inspected:
110178

0 commit comments

Comments
 (0)