Class: BaseService

Creates an instance of the Base Service of which all service must inherit. Services are spawned from your service.json file and managed by a helper thread (Service Manager). Services communicate their status and receive status of other service through the Service Manager. Services have an intial handshake with the Service Manager on load and then either go online or wait for dependant services to come online. Service intialization is completly async which allows all services to load at the same time as long as their dependencies have been met.

new BaseService
(params)

services/baseService.js, line 37
Name Type Description
params Object
Name Type Description
name String

The name of the service

Example
var baseService = require("../baseService");
	function NewService() {

		return this;
	}
	NewService.prototype = new baseService('NewService');
	var serviceInstance = new NewService();
	serviceInstance.setOnConnectionComplete(function (callback) {
		callback();
	});

	serviceInstance.start();
	module.exports = serviceInstance;

Members

RouterClientstring

The name of the service

statuss

Service status

Methods

addNeededClients
(services)

services/baseService.js, line 125

Add a client to clients needed list. This clientz will wait for all clients in this list to be complete.

Name Type Description
services Array

An array of service names

addNeededServices
(services)

services/baseService.js, line 109

Add a service to services needed list. This service will wait for all services in this list to be complete.

Name Type Description
services Array

An array of service names

clearServicesNeeded
(services)

services/baseService.js, line 141

Clear the services needed. By default, routerClient is in the required service

Name Type Description
services Array

Add a service to services needed list. This service will wait for all services in this list to be complete.

delayStartup
()

services/baseService.js, line 297

Delays startup based on information passed in from the serviceManager.

handleShutdown
()

services/baseService.js, line 345

When the application sends out a shutdown message, this function is invoked. It iterates through any registered cleanup methods. When all of them have finished (or 10 seconds elapses), it sends a response to the application saying that it's completed cleanup (shutdownComplete, below).

listenForShutdown
()

services/baseService.js, line 390

onShutdown
()

services/baseService.js, line 338

A convenience function.

shutdownComplete
()

services/baseService.js, line 381

Fired when all cleanup methods have been finished.

start
()

services/baseService.js, line 398

Starts the service.