Built motion from commit ffdca78c.|2.6.24
[motion2.git] / server / services / routing / server / applications / agent.js
index ac15073..dd3f301 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf619=['message','join','find','timeout','createQueue','channel','format','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','stop','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map'];(function(_0x8f82df,_0x4ad0e9){var _0x19212a=function(_0xa30958){while(--_0xa30958){_0x8f82df['push'](_0x8f82df['shift']());}};_0x19212a(++_0x4ad0e9);}(_0xf619,0x7c));var _0x9f61=function(_0x11387a,_0x9d398e){_0x11387a=_0x11387a-0x0;var _0x54fc5c=_0xf619[_0x11387a];return _0x54fc5c;};'use strict';var schema=require(_0x9f61('0x0'));var _=require(_0x9f61('0x1'));var util=require(_0x9f61('0x2'));var seqqueue=require(_0x9f61('0x3'));var logger=require(_0x9f61('0x4'))('routing');var strategy=require(_0x9f61('0x5'));var queue=schema({'name':{'type':'string','required':!![],'message':_0x9f61('0x6')},'timeout':{'type':'number','message':_0x9f61('0x7')}});function writeLog(_0x68324e,_0x4f8563,_0xeb63aa){return logger[_0x9f61('0x8')](util['format']('[%s][AGENT][NAME:%s][STATUS:%s]',_0x68324e,_0x4f8563[_0x9f61('0x9')],_0xeb63aa));}function handleFindAgent(_0x40282d){return function(_0x13e72a){return _0x13e72a[_0x9f61('0x9')]['toLowerCase']()===_0x40282d[_0x9f61('0xa')]();};}exports[_0x9f61('0xb')]=function(_0xe3ba10,_0x4ca51b,_0x231732,_0x21d72f){return function(_0xe142a0){try{var _0x450dcf={'name':_0x4ca51b[0x0],'timeout':_0x4ca51b[0x1]};var _0x315747=queue[_0x9f61('0x0')](_0x450dcf,{'typecast':!![]});if(_0x315747[_0x9f61('0xc')]){logger[_0x9f61('0xd')](_0x9f61('0xe'),_0xe3ba10,_[_0x9f61('0xf')](_0x315747,_0x9f61('0x10'))[_0x9f61('0x11')](',\x20'));_0xe142a0['stop']();}else{var _0x15c12d=_[_0x9f61('0x12')](_0x231732['agents'],handleFindAgent(_0x450dcf[_0x9f61('0x9')]));if(_0x15c12d){var _0x1c8373=(_0x450dcf[_0x9f61('0x13')]||0xa)*0x3e8;var _0x15e6e6,_0x74d620;var _0x43838f=seqqueue[_0x9f61('0x14')](_0x1c8373);_0x43838f['id']=_0xe3ba10;_0x43838f['atimeout']=_0x1c8373;_0x43838f[_0x9f61('0x15')]=_0x21d72f[_0x9f61('0x15')];writeLog(_0xe3ba10,_0x15c12d,util[_0x9f61('0x16')]('START:%s',_0x1c8373));_0x231732[_0x9f61('0x17')][_0xe3ba10]['on'](_0x9f61('0x18'),function(){logger[_0x9f61('0x8')](_0x9f61('0x19'),_0xe3ba10);clearTimeout(_0x74d620);_0x74d620=undefined;_0x43838f['close']();if(_0x231732[_0x9f61('0x17')][_0xe3ba10]){delete _0x231732[_0x9f61('0x17')][_0xe3ba10];}_0xe142a0[_0x9f61('0x1a')]();});_0x231732[_0x9f61('0x17')][_0xe3ba10]['on'](_0x9f61('0x1b'),function(){if(_0x231732[_0x9f61('0x17')][_0xe3ba10]){delete _0x231732[_0x9f61('0x17')][_0xe3ba10];}});_0x74d620=setTimeout(function(){logger[_0x9f61('0x8')](_0x9f61('0x1c'),_0xe3ba10);clearTimeout(_0x74d620);_0x43838f['close']();_0xe142a0[_0x9f61('0x1d')]();},_0x1c8373);strategy[_0x9f61('0x1e')](_0x43838f,_0x15c12d,_0x231732,_0x21d72f);}else{logger[_0x9f61('0xd')](_0x9f61('0x1f'),_0xe3ba10,_0x450dcf[_0x9f61('0x9')]);_0xe142a0[_0x9f61('0x1a')]();}}}catch(_0x16971f){console[_0x9f61('0x20')](_0x16971f);logger['error'](_0x9f61('0x21'),_0xe3ba10,_0x16971f[_0x9f61('0x22')]);_0xe142a0[_0x9f61('0x1a')]();}};};
\ No newline at end of file
+var _0x8974=['agents','name','timeout','createQueue','atimeout','channel','START:%s','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','next','agent','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','validate','lodash','routing','number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','toLowerCase','consequence','[%s][AGENT]\x20%s','message','join','stop','find'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x8974,0xcb));var _0x4897=function(_0x35ef3f,_0x1ddd2e){_0x35ef3f=_0x35ef3f-0x0;var _0x41fbc8=_0x8974[_0x35ef3f];return _0x41fbc8;};'use strict';var schema=require(_0x4897('0x0'));var _=require(_0x4897('0x1'));var util=require('util');var seqqueue=require('seq-queue');var logger=require('../../../../config/logger')(_0x4897('0x2'));var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x4897('0x3'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x41d344,_0x43479a,_0xa2a62a){return logger[_0x4897('0x4')](util[_0x4897('0x5')](_0x4897('0x6'),_0x41d344,_0x43479a['name'],_0xa2a62a));}function handleFindAgent(_0x4015fb){return function(_0x5e7fde){return _0x5e7fde['name']['toLowerCase']()===_0x4015fb[_0x4897('0x7')]();};}exports[_0x4897('0x8')]=function(_0x1f560b,_0x4b8847,_0x22fce7,_0x440e9d){return function(_0x5afc92){try{var _0x2c2960={'name':_0x4b8847[0x0],'timeout':_0x4b8847[0x1]};var _0x2354f6=queue[_0x4897('0x0')](_0x2c2960,{'typecast':!![]});if(_0x2354f6['length']){logger['error'](_0x4897('0x9'),_0x1f560b,_['map'](_0x2354f6,_0x4897('0xa'))[_0x4897('0xb')](',\x20'));_0x5afc92[_0x4897('0xc')]();}else{var _0x1263c0=_[_0x4897('0xd')](_0x22fce7[_0x4897('0xe')],handleFindAgent(_0x2c2960[_0x4897('0xf')]));if(_0x1263c0){var _0x36f441=(_0x2c2960[_0x4897('0x10')]||0xa)*0x3e8;var _0x3866e9,_0x444bf6;var _0x36428e=seqqueue[_0x4897('0x11')](_0x36f441);_0x36428e['id']=_0x1f560b;_0x36428e[_0x4897('0x12')]=_0x36f441;_0x36428e[_0x4897('0x13')]=_0x440e9d[_0x4897('0x13')];writeLog(_0x1f560b,_0x1263c0,util[_0x4897('0x5')](_0x4897('0x14'),_0x36f441));_0x22fce7[_0x4897('0x15')][_0x1f560b]['on']('end',function(){logger[_0x4897('0x4')](_0x4897('0x16'),_0x1f560b);clearTimeout(_0x444bf6);_0x444bf6=undefined;_0x36428e[_0x4897('0x17')]();if(_0x22fce7[_0x4897('0x15')][_0x1f560b]){delete _0x22fce7[_0x4897('0x15')][_0x1f560b];}_0x5afc92[_0x4897('0xc')]();});_0x22fce7[_0x4897('0x15')][_0x1f560b]['on'](_0x4897('0x18'),function(){if(_0x22fce7['rules'][_0x1f560b]){delete _0x22fce7[_0x4897('0x15')][_0x1f560b];}});_0x444bf6=setTimeout(function(){logger[_0x4897('0x4')]('[%s][AGENT]\x20ROUTING\x20END',_0x1f560b);clearTimeout(_0x444bf6);_0x36428e[_0x4897('0x17')]();_0x5afc92[_0x4897('0x19')]();},_0x36f441);strategy[_0x4897('0x1a')](_0x36428e,_0x1263c0,_0x22fce7,_0x440e9d);}else{logger[_0x4897('0x1b')](_0x4897('0x1c'),_0x1f560b,_0x2c2960[_0x4897('0xf')]);_0x5afc92['stop']();}}}catch(_0x56a2f8){console['log'](_0x56a2f8);logger[_0x4897('0x1b')](_0x4897('0x1d'),_0x1f560b,_0x56a2f8[_0x4897('0x1e')]);_0x5afc92[_0x4897('0xc')]();}};};
\ No newline at end of file