Built motion from commit efa66e19.|2.6.22
[motion2.git] / server / services / routing / server / applications / agent.js
index 4831f72..e310070 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb7a6=['number','timeout\x20is\x20a\x20number','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','message','join','find','agents','timeout','createQueue','atimeout','channel','format','START:%s','rules','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','stop','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','validate','lodash','seq-queue','../../../../config/logger','routing','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0x544463,_0x214963){var _0x1add2a=function(_0x5e1006){while(--_0x5e1006){_0x544463['push'](_0x544463['shift']());}};_0x1add2a(++_0x214963);}(_0xb7a6,0x66));var _0x6b7a=function(_0x1967f8,_0x126c17){_0x1967f8=_0x1967f8-0x0;var _0x2d67c5=_0xb7a6[_0x1967f8];return _0x2d67c5;};'use strict';var schema=require(_0x6b7a('0x0'));var _=require(_0x6b7a('0x1'));var util=require('util');var seqqueue=require(_0x6b7a('0x2'));var logger=require(_0x6b7a('0x3'))(_0x6b7a('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':_0x6b7a('0x5')},'timeout':{'type':_0x6b7a('0x6'),'message':_0x6b7a('0x7')}});function writeLog(_0x52271a,_0x5df617,_0x122521){return logger['info'](util['format'](_0x6b7a('0x8'),_0x52271a,_0x5df617[_0x6b7a('0x9')],_0x122521));}function handleFindAgent(_0x4f3449){return function(_0x4cd8ab){return _0x4cd8ab[_0x6b7a('0x9')][_0x6b7a('0xa')]()===_0x4f3449[_0x6b7a('0xa')]();};}exports[_0x6b7a('0xb')]=function(_0x195073,_0x48a754,_0x21eb42,_0x5b6833){return function(_0x127d0c){try{var _0x3cbf59={'name':_0x48a754[0x0],'timeout':_0x48a754[0x1]};var _0x3ef567=queue[_0x6b7a('0x0')](_0x3cbf59,{'typecast':!![]});if(_0x3ef567[_0x6b7a('0xc')]){logger[_0x6b7a('0xd')](_0x6b7a('0xe'),_0x195073,_['map'](_0x3ef567,_0x6b7a('0xf'))[_0x6b7a('0x10')](',\x20'));_0x127d0c['stop']();}else{var _0x507dc4=_[_0x6b7a('0x11')](_0x21eb42[_0x6b7a('0x12')],handleFindAgent(_0x3cbf59[_0x6b7a('0x9')]));if(_0x507dc4){var _0x23930e=(_0x3cbf59[_0x6b7a('0x13')]||0xa)*0x3e8;var _0x1eab7c,_0x4ce5a1;var _0x285957=seqqueue[_0x6b7a('0x14')](_0x23930e);_0x285957['id']=_0x195073;_0x285957[_0x6b7a('0x15')]=_0x23930e;_0x285957['channel']=_0x5b6833[_0x6b7a('0x16')];writeLog(_0x195073,_0x507dc4,util[_0x6b7a('0x17')](_0x6b7a('0x18'),_0x23930e));_0x21eb42[_0x6b7a('0x19')][_0x195073]['on']('end',function(){logger[_0x6b7a('0x1a')](_0x6b7a('0x1b'),_0x195073);clearTimeout(_0x4ce5a1);_0x4ce5a1=undefined;_0x285957[_0x6b7a('0x1c')]();if(_0x21eb42[_0x6b7a('0x19')][_0x195073]){delete _0x21eb42['rules'][_0x195073];}_0x127d0c[_0x6b7a('0x1d')]();});_0x21eb42[_0x6b7a('0x19')][_0x195073]['on'](_0x6b7a('0x1e'),function(){if(_0x21eb42['rules'][_0x195073]){delete _0x21eb42['rules'][_0x195073];}});_0x4ce5a1=setTimeout(function(){logger[_0x6b7a('0x1a')](_0x6b7a('0x1f'),_0x195073);clearTimeout(_0x4ce5a1);_0x285957[_0x6b7a('0x1c')]();_0x127d0c[_0x6b7a('0x20')]();},_0x23930e);strategy[_0x6b7a('0x21')](_0x285957,_0x507dc4,_0x21eb42,_0x5b6833);}else{logger[_0x6b7a('0xd')](_0x6b7a('0x22'),_0x195073,_0x3cbf59[_0x6b7a('0x9')]);_0x127d0c[_0x6b7a('0x1d')]();}}}catch(_0x1bf028){console['log'](_0x1bf028);logger['error'](_0x6b7a('0x23'),_0x195073,_0x1bf028['stack']);_0x127d0c[_0x6b7a('0x1d')]();}};};
\ No newline at end of file
+var _0x8ea5=['map','join','stop','find','agents','timeout','createQueue','atimeout','channel','START:%s','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','stack','validate','lodash','../../../../config/logger','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','error','[%s][AGENT]\x20%s'];(function(_0x5ab5cd,_0x44a06d){var _0x59a4ad=function(_0x5dd8a9){while(--_0x5dd8a9){_0x5ab5cd['push'](_0x5ab5cd['shift']());}};_0x59a4ad(++_0x44a06d);}(_0x8ea5,0x9a));var _0x58ea=function(_0x2ca11f,_0x12705c){_0x2ca11f=_0x2ca11f-0x0;var _0x12af9b=_0x8ea5[_0x2ca11f];return _0x12af9b;};'use strict';var schema=require(_0x58ea('0x0'));var _=require(_0x58ea('0x1'));var util=require('util');var seqqueue=require('seq-queue');var logger=require(_0x58ea('0x2'))(_0x58ea('0x3'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0x58ea('0x4'),'required':!![],'message':_0x58ea('0x5')},'timeout':{'type':_0x58ea('0x6'),'message':_0x58ea('0x7')}});function writeLog(_0x288ef1,_0x4e4fbd,_0x2f78cf){return logger[_0x58ea('0x8')](util[_0x58ea('0x9')](_0x58ea('0xa'),_0x288ef1,_0x4e4fbd['name'],_0x2f78cf));}function handleFindAgent(_0x251e13){return function(_0xa46936){return _0xa46936[_0x58ea('0xb')][_0x58ea('0xc')]()===_0x251e13['toLowerCase']();};}exports[_0x58ea('0xd')]=function(_0x362578,_0x4fd3e0,_0x22d352,_0x151316){return function(_0xa3d90b){try{var _0x6a82a7={'name':_0x4fd3e0[0x0],'timeout':_0x4fd3e0[0x1]};var _0x7d029a=queue[_0x58ea('0x0')](_0x6a82a7,{'typecast':!![]});if(_0x7d029a['length']){logger[_0x58ea('0xe')](_0x58ea('0xf'),_0x362578,_[_0x58ea('0x10')](_0x7d029a,'message')[_0x58ea('0x11')](',\x20'));_0xa3d90b[_0x58ea('0x12')]();}else{var _0x24b99c=_[_0x58ea('0x13')](_0x22d352[_0x58ea('0x14')],handleFindAgent(_0x6a82a7[_0x58ea('0xb')]));if(_0x24b99c){var _0x2573e3=(_0x6a82a7[_0x58ea('0x15')]||0xa)*0x3e8;var _0x370e56,_0x9b4bb6;var _0x5875a5=seqqueue[_0x58ea('0x16')](_0x2573e3);_0x5875a5['id']=_0x362578;_0x5875a5[_0x58ea('0x17')]=_0x2573e3;_0x5875a5[_0x58ea('0x18')]=_0x151316[_0x58ea('0x18')];writeLog(_0x362578,_0x24b99c,util[_0x58ea('0x9')](_0x58ea('0x19'),_0x2573e3));_0x22d352[_0x58ea('0x1a')][_0x362578]['on']('end',function(){logger['info'](_0x58ea('0x1b'),_0x362578);clearTimeout(_0x9b4bb6);_0x9b4bb6=undefined;_0x5875a5[_0x58ea('0x1c')]();if(_0x22d352[_0x58ea('0x1a')][_0x362578]){delete _0x22d352[_0x58ea('0x1a')][_0x362578];}_0xa3d90b['stop']();});_0x22d352[_0x58ea('0x1a')][_0x362578]['on'](_0x58ea('0x1d'),function(){if(_0x22d352[_0x58ea('0x1a')][_0x362578]){delete _0x22d352[_0x58ea('0x1a')][_0x362578];}});_0x9b4bb6=setTimeout(function(){logger['info'](_0x58ea('0x1e'),_0x362578);clearTimeout(_0x9b4bb6);_0x5875a5[_0x58ea('0x1c')]();_0xa3d90b[_0x58ea('0x1f')]();},_0x2573e3);strategy[_0x58ea('0x20')](_0x5875a5,_0x24b99c,_0x22d352,_0x151316);}else{logger['error']('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x362578,_0x6a82a7[_0x58ea('0xb')]);_0xa3d90b['stop']();}}}catch(_0x2b3dc1){console['log'](_0x2b3dc1);logger['error']('[%s][QUEUE]\x20%s',_0x362578,_0x2b3dc1[_0x58ea('0x21')]);_0xa3d90b[_0x58ea('0x12')]();}};};
\ No newline at end of file