Skip to content

axians/microservicebus-core

Repository files navigation

alt

Build Status Downloads npm

microservicebus-core

microServiceBus.com is an integration platform for IoT and enterprise applications. This platform lets you expose microservices from small devices and large systems using a hosting infrastructure. These host can run on both Linux and Windows using components built either natively or using node.js.

For more information about microServiceBus.com

To create your own service using microServiceBus.com.

Simply follow the template below. When your are done, simply save in the portal.

/* 	
 * Service template for node.js	
 * 	
 * To use this template, simply add your code in Start and Stop method	
*/	
var timerEvent; // In case you use a timer for fetching data	
 	
var exports = module.exports = {	
    Start : function () {	
     	
        var base  = this;	
        timerEvent = setInterval(function () {	
            var message = {	
                someRandomValue : Math.random() 	
            };	
                	
            // Create an integration message using the CreateMessage 	
            // method.	
             base.SubmitMessage(message);  	
             	
        }, 3000);    	
        	
    },	
    // The Stop method is called from the Host when the Host is 	
    // either stopped or has updated integrations. 	
    Stop : function () {	
        // Stop the timerEvent	
        clearInterval(timerEvent);	
    },    	
    	
    // The Process method is called from the host as it receives 	
    // messages from the hub. The [messasge] parameter is a JSON 	
    // object (the payload) and the [context] parameter is a 	
    // value/pair object with parameters provided by the hub.	
    Process : function (message, context) {	
        // TO DO! This is where you code for when a message is sent	
        // to this host.	
        	
        var x = JSON.parse("<test/>");	
        base.Debug('');	
        base.Debug('The Process method is called.');	
        var payload = JSON.stringify(message);	
        base.Debug(payload);	
        base.Debug('');	
    },  	
}