Skip to content

Commit

Permalink
v5.2.0 add firehose
Browse files Browse the repository at this point in the history
  • Loading branch information
ewilson / virgilvox committed Aug 22, 2017
1 parent e105b70 commit 5a76f2f
Show file tree
Hide file tree
Showing 3 changed files with 297 additions and 31 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "meshblu-server",
"version": "5.1.7",
"version": "5.2.0",
"description": "A bundled version of meshblu-core",
"main": "dist/meshblu-core-runner.js",
"repository": {
Expand All @@ -24,6 +24,7 @@
"dashdash": "^1.14.0",
"debug": "^2.6.8",
"meshblu-core-dispatcher": "^20.0.7",
"meshblu-core-firehose-socket.io": "^2.0.0",
"meshblu-core-protocol-adapter-http": "^6.0.3",
"meshblu-core-worker-webhook": "^4.1.4",
"sigterm-handler": "^2.0.0",
Expand Down
8 changes: 8 additions & 0 deletions src/meshblu-core-runner.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@ async = require('async')
{EventEmitter} = require 'events'
DispatcherWorker = require('meshblu-core-dispatcher')
MeshbluHttp = require('meshblu-core-protocol-adapter-http')
MeshbluFirehose = require('meshblu-core-firehose-socket.io')
WebhookWorker = require('meshblu-core-worker-webhook')
debug = require('debug')('meshblu:meshblu-core-runner')

class MeshbluCoreRunner extends EventEmitter
constructor: (options) ->
@dispatcherWorker = new DispatcherWorker options.dispatcherWorker
@meshbluHttp = new MeshbluHttp options.meshbluHttp
unless options.meshbluFirehose.disable
@meshbluFirehose = new MeshbluFirehose options.meshbluFirehose
unless options.webhookWorker.disable
@webhookWorker = new WebhookWorker options.webhookWorker

Expand All @@ -20,6 +23,7 @@ class MeshbluCoreRunner extends EventEmitter
debug '->destroy'
tasks = []
tasks.push @meshbluHttp.destroy
tasks.push @meshbluFirehose.stop if @meshbluFirehose?
tasks.push @dispatcherWorker.stop
tasks.push @webhookWorker.stop if @webhookWorker?
async.parallel tasks, callback
Expand All @@ -36,6 +40,7 @@ class MeshbluCoreRunner extends EventEmitter
debug '->stop'
tasks = []
tasks.push @meshbluHttp.stop
tasks.push @meshbluFirehose.stop if @meshbluFirehose?
tasks.push @dispatcherWorker.stop
tasks.push @webhookWorker.stop if @webhookWorker?
async.parallel tasks, callback
Expand All @@ -48,6 +53,9 @@ class MeshbluCoreRunner extends EventEmitter
@webhookWorker?.start (error) =>
@emit 'error', error if error?

@meshbluFirehose?.run (error) =>
@emit 'error', error if error?

@meshbluHttp.run callback

module.exports = MeshbluCoreRunner
Loading

0 comments on commit 5a76f2f

Please sign in to comment.