Commit 4e69d83f authored by project's avatar project

--no commit message

--no commit message
parent f77bb361
{
"type" : "rabbitmq",
"url" : "amqp://lab1.igridproject.info"
"url" : "amqp://bigmaster.igridproject.info"
}
......@@ -11,6 +11,7 @@ function RPCServer(config)
RPCServer.prototype.start = function(cb)
{
var self = this;
amqp.connect(self.url, function(err, conn) {
if(err){
return cb(err);
......
var ctx = require('./context');
var StorageService = ctx.getLib('storage-service/main');
var ss = new StorageService(ctx.config);
ss.start();
var ctx = require('../context');
var rpcserver = ctx.getLib('lib/amqp/rpcserver');
module.exports = StorageService;
function StorageService(cfg)
{
this.config = cfg;
}
StorageService.prototype.start = function()
{
console.log('Starting Storage Service ...\n');
amqp_start(this.config);
http_start(this.config);
}
function amqp_start(cfg)
{
var amqp_cfg = cfg.amqp;
var server = new rpcserver({
url : amqp_cfg.url,
name : 'storage_request'
});
server.set_remote_function(function(req,callback){
var n = parseInt(req.t);
console.log('REQUEST ' + req);
setTimeout(function(){
callback(null,{'time':n,'data':req.d});
},n);
})
server.start(function(err){
if(!err){
console.log('AMQP START\t\t\t[OK]');
}
});
}
function http_start(cfg)
{
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {
'Content-Type': 'text/plain; charset=UTF-8'
});
res.end("req http " + String( (new Date()).getTime() ));
}).listen(9080, "");
}
module.exports = StorageService;
function StorageService(cfg)
{
this.config = cfg;
}
StorageService.prototype.start = function()
{
}
......@@ -4,7 +4,8 @@ var amqp_cfg = ctx.config.amqp;
var RPCCaller = ctx.getLib('lib/amqp/rpccaller');
var caller = new RPCCaller({
url : amqp_cfg.url
url : amqp_cfg.url,
name :'storage_request'
});
......
......@@ -24,7 +24,7 @@ http.createServer(function (req, res) {
res.writeHead(200, {
'Content-Type': 'text/plain; charset=UTF-8'
});
res.end('Hello from node-bigstream.\n');
console.log(req.body);
res.end("req");
}).listen(9080, "");
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment