Skip to content
This repository has been archived by the owner on Feb 11, 2020. It is now read-only.

Persistance Support #36

Merged
merged 30 commits into from
Jun 26, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
5f57283
Implemented basic persistance layer on top of LevelUp.
mcollina Jun 17, 2013
718126e
Moved the wiring to the Server in the persistance itself.
mcollina Jun 17, 2013
4b953cf
Fixed spurious failure in the levelup tests.
mcollina Jun 18, 2013
69d1d15
Restoring a client's subscriptions after a disconnect.
mcollina Jun 18, 2013
a8785e2
Using a global nop instead of creating an empty function.
mcollina Jun 18, 2013
a193e4d
Added the support for uncleaned clients.
mcollina Jun 18, 2013
440ede7
Added the TTL to the persistance.
mcollina Jun 19, 2013
d4838ce
Updates node-level-ttl to the released 0.2.0.
mcollina Jun 20, 2013
a33587f
Made the persistances work even if called as a Function.
mcollina Jun 21, 2013
031e8ff
Added basic persistance layer for redis.
mcollina Jun 21, 2013
8ac488b
Added support for pattern subscriptions in the persistance.
mcollina Jun 21, 2013
48012d8
Added restoration support of the Qlobber data structure for LevelUp.
mcollina Jun 21, 2013
53c4d17
Added synchronization support for Redis persistance.
mcollina Jun 21, 2013
397f478
Limiting unclean client handling to QoS 1 subscriptions.
mcollina Jun 21, 2013
0ba1b7a
Updated Ascoltatori to 0.7.0
mcollina Jun 23, 2013
0bfc589
Added MongoDB as an optional dependency.
mcollina Jun 23, 2013
fa72c3c
Added mongodb in .travis.yml.
mcollina Jun 23, 2013
ff5b859
Implemented mongo persistance.
mcollina Jun 24, 2013
9d12d91
Made Mongo persistance spec faster.
mcollina Jun 24, 2013
2cbbe16
Added 'before' to the .jshintrc.
mcollina Jun 24, 2013
3bc35d3
Fixed offline topic support with wildcards in Mongodb.
mcollina Jun 25, 2013
ed772c8
Added memoization of topicPatterns.
mcollina Jun 25, 2013
90c1677
Reformatting of the persistance utilities module.
mcollina Jun 25, 2013
0f4bebc
Implemtened CLI support for persistance.
mcollina Jun 25, 2013
5ec3c83
Added benchmark support for uncleaned clients.
mcollina Jun 25, 2013
b93bf04
Refactored inflight support in Client to support storing them on disc…
mcollina Jun 25, 2013
722af40
Added support for storing inflight packets for client.
mcollina Jun 25, 2013
89a136e
Added logging to the persistance wiring.
mcollina Jun 26, 2013
a0fac09
Added API comments.
mcollina Jun 26, 2013
70bb77f
Updated the README with the persistance support.
mcollina Jun 26, 2013
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ results
npm-debug.log
node_modules
docs
mosquitto.db
4 changes: 3 additions & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
"beforeEach": false,
"describe": false,
"mosca": false,
"expect": false
"expect": false,
"before": false,
"moscaSettings": false
}
}
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ node_js:
services:
- rabbitmq
- redis-server
- mongodb
50 changes: 38 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ client.
## Features

* MQTT 3.1 compliant
* QoS 0 and QoS 1, but without storage
* QoS 0 and QoS 1
* Various storage options for QoS 1 offline packets,
and subscriptions.
* Built on top on node.js
* As fast as it is possible
* Usable inside ANY other node.js app, see the
Expand All @@ -52,20 +54,29 @@ client.
Mosca supports some command line options:

```
Usage: mosca [options]
Usage: mosca [options] [command]

Commands:

adduser <user> <pass> Add a user to the given credentials file
rmuser <user> Removes a user from the given credentials file
start start the server (optional)

Options:

-h, --help output usage information
-V, --version output the version number
-p, --port <n> the port to listen to
--parent-port <n> the parent port to connect to
--parent-host <s> the parent host to connect to
--parent-prefix <s> the prefix to use in the parent broker
-c, --config <c> the config file to use (override every
other options)
-v, --verbose set the bunyan log to INFO
--very-verbose set the bunyan log to DEBUG
-h, --help output usage information
-V, --version output the version number
-p, --port <n> the port to listen to
--parent-port <n> the parent port to connect to
--parent-host <s> the parent host to connect to
--parent-prefix <s> the prefix to use in the parent broker
--credentials <file> the file containing the credentials
--authorize-publish <pattern> the pattern for publishing to topics for the added user
--authorize-subscribe <pattern> the pattern for subscribing to topics for the added user
-c, --config <c> the config file to use (override every other option)
-d, --db <path> the path were to store the database
-v, --verbose set the bunyan log to INFO
--very-verbose set the bunyan log to DEBUG
```

However you can only use a MQTT backend with the command line options.
Expand Down Expand Up @@ -126,6 +137,21 @@ The patterns are checked and validated using
The credentials file can be automatically reladed by __Mosca__ if it
receives a `SIGHUP`.

## Persistance

The MQTT specification requires a persistent storage for offline QoS 1
subscription that has been done by an unclean client.
__Mosca__ offers several persitance options:

* [Memory](http://mcollina.github.com/mosca/docs/lib/persistance/memory.js.html),
* [LevelUp](http://mcollina.github.com/mosca/docs/lib/persistance/levelup.js.html),
* [Redis](http://mcollina.github.com/mosca/docs/lib/persistance/redis.js.html),
* [MongoDB](http://mcollina.github.com/mosca/docs/lib/persistance/mongo.js.html),

All of them can be configured from the configuration file, under the
`persistance` key. The only exception is LevelUp, which can be specified
by using the `--db` option from the command line.

## Contributing to Mosca

* Check out the latest master to make sure the feature hasn't been
Expand Down
3 changes: 2 additions & 1 deletion benchmarks/single_pub_sub.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var mqtt = require("mqtt");

function setup(done) {

var client = mqtt.createClient(1883, "localhost", { clean: true });
var client = mqtt.createClient(1883, "localhost", { clean: program.clean });

client.on("connect", function () {
client.subscribe("hello", { qos: program.qos }, function () {
Expand Down Expand Up @@ -41,6 +41,7 @@ function bench(client, done) {
}

program
.option("--clean", "use clean clients")
.option("--header", "add header")
.option("-r, --runs <n>", "the number of runs to execute", parseInt, 10)
.option("-q, --qos <n>", "the QoS level (0, 1, 2)", parseInt, 0)
Expand Down
Loading