Commit cd374122 authored by Kamron Aroonrua's avatar Kamron Aroonrua 💬

fix amqp startup bug

parent 3904d341
...@@ -89,6 +89,13 @@ SchedulerService.prototype._start_controller = function () ...@@ -89,6 +89,13 @@ SchedulerService.prototype._start_controller = function ()
var self=this; var self=this;
var topic = 'ctl.trigger.#'; var topic = 'ctl.trigger.#';
self.evs.sub(topic,function(err,msg){ self.evs.sub(topic,function(err,msg){
if(err){
console.log('SCHEDULER:AMQP ERROR Restarting ...');
setTimeout(function(){
process.exit(1);
},5000);
}
if(!msg){return;} if(!msg){return;}
var ctl = msg.data; var ctl = msg.data;
......
...@@ -74,6 +74,12 @@ HTTPListener.prototype._controller_start = function () ...@@ -74,6 +74,12 @@ HTTPListener.prototype._controller_start = function ()
var self=this; var self=this;
var topic = 'ctl.trigger.#'; var topic = 'ctl.trigger.#';
self.evs.sub(topic,function(err,msg){ self.evs.sub(topic,function(err,msg){
if(err){
console.log('WWW:AMQP ERROR Restarting ...');
setTimeout(function(){
process.exit(1);
},5000);
}
if(!msg){return;} if(!msg){return;}
var ctl = msg.data; var ctl = msg.data;
......
...@@ -60,7 +60,14 @@ JW.prototype.amqp_pmr_start = function () ...@@ -60,7 +60,14 @@ JW.prototype.amqp_pmr_start = function ()
}); });
self.amqp_server_pmr.start(function(err){ self.amqp_server_pmr.start(function(err){
console.log('WORKER:Primary Start\t\t[OK]'); if(err){
console.log('WORKER:AMQP ERROR Restarting ...');
setTimeout(function(){
process.exit(1);
},5000);
}else{
console.log('WORKER:Primary Start\t\t[OK]');
}
}) })
} }
...@@ -80,7 +87,13 @@ JW.prototype.amqp_snd_start = function () ...@@ -80,7 +87,13 @@ JW.prototype.amqp_snd_start = function ()
}); });
self.amqp_server_snd.start(function(err){ self.amqp_server_snd.start(function(err){
console.log('WORKER:Secondary Start\t\t[OK]'); if(err){
console.log('WORKER:AMQP ERROR Restarting ...');
setTimeout(function(){
process.exit(1);
},5000);
}else{console.log('WORKER:Secondary Start\t\t[OK]');}
}) })
} }
......
...@@ -11,8 +11,10 @@ ...@@ -11,8 +11,10 @@
"exec_mode" : "cluster" "exec_mode" : "cluster"
}, },
{ {
"name" : "bs.worker.ins0", "name" : "bs.worker",
"script" : "./work-jobworker.js" "script" : "./work-jobworker.js",
"exec_mode" : "cluster",
"instances" : 0
}, },
{ {
"name" : "bs.trigger.scheduler", "name" : "bs.trigger.scheduler",
......
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