Built motion from commit da617fac.|2.6.6
[motion2.git] / server / services / routing / server / applications / agent.js
index 8055d9b..5cdfe3d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9c5f=['[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','validate','routing','string','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','[%s][AGENT]\x20%s','map','stop','find','agents','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','next','error'];(function(_0x3f56ed,_0xd8f0be){var _0x32cad8=function(_0x9ff1f7){while(--_0x9ff1f7){_0x3f56ed['push'](_0x3f56ed['shift']());}};_0x32cad8(++_0xd8f0be);}(_0x9c5f,0x13b));var _0xf9c5=function(_0x534eb2,_0x2b9f02){_0x534eb2=_0x534eb2-0x0;var _0xfae93b=_0x9c5f[_0x534eb2];return _0xfae93b;};'use strict';var schema=require(_0xf9c5('0x0'));var _=require('lodash');var util=require('util');var seqqueue=require('seq-queue');var logger=require('../../../../config/logger')(_0xf9c5('0x1'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0xf9c5('0x2'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x1e7219,_0x426878,_0x15e717){return logger[_0xf9c5('0x3')](util[_0xf9c5('0x4')](_0xf9c5('0x5'),_0x1e7219,_0x426878[_0xf9c5('0x6')],_0x15e717));}function handleFindAgent(_0x32217a){return function(_0x17671a){return _0x17671a[_0xf9c5('0x6')][_0xf9c5('0x7')]()===_0x32217a['toLowerCase']();};}exports['consequence']=function(_0x1ddbe5,_0x2005ed,_0x502743,_0x434e3d){return function(_0x5c7ae1){try{var _0x8c436={'name':_0x2005ed[0x0],'timeout':_0x2005ed[0x1]};var _0x1c0b51=queue['validate'](_0x8c436,{'typecast':!![]});if(_0x1c0b51['length']){logger['error'](_0xf9c5('0x8'),_0x1ddbe5,_[_0xf9c5('0x9')](_0x1c0b51,'message')['join'](',\x20'));_0x5c7ae1[_0xf9c5('0xa')]();}else{var _0x50c54b=_[_0xf9c5('0xb')](_0x502743[_0xf9c5('0xc')],handleFindAgent(_0x8c436[_0xf9c5('0x6')]));if(_0x50c54b){var _0x3c97c5=(_0x8c436['timeout']||0xa)*0x3e8;var _0x132110,_0x474d00;var _0x169d92=seqqueue[_0xf9c5('0xd')](_0x3c97c5);_0x169d92['id']=_0x1ddbe5;_0x169d92[_0xf9c5('0xe')]=_0x3c97c5;_0x169d92['channel']=_0x434e3d[_0xf9c5('0xf')];writeLog(_0x1ddbe5,_0x50c54b,util[_0xf9c5('0x4')](_0xf9c5('0x10'),_0x3c97c5));_0x502743[_0xf9c5('0x11')][_0x1ddbe5]['on'](_0xf9c5('0x12'),function(){logger[_0xf9c5('0x3')](_0xf9c5('0x13'),_0x1ddbe5);clearTimeout(_0x474d00);_0x474d00=undefined;_0x169d92[_0xf9c5('0x14')]();if(_0x502743[_0xf9c5('0x11')][_0x1ddbe5]){delete _0x502743['rules'][_0x1ddbe5];}_0x5c7ae1[_0xf9c5('0xa')]();});_0x502743[_0xf9c5('0x11')][_0x1ddbe5]['on']('complete',function(){if(_0x502743['rules'][_0x1ddbe5]){delete _0x502743['rules'][_0x1ddbe5];}});_0x474d00=setTimeout(function(){logger[_0xf9c5('0x3')]('[%s][AGENT]\x20ROUTING\x20END',_0x1ddbe5);clearTimeout(_0x474d00);_0x169d92['close']();_0x5c7ae1[_0xf9c5('0x15')]();},_0x3c97c5);strategy['agent'](_0x169d92,_0x50c54b,_0x502743,_0x434e3d);}else{logger[_0xf9c5('0x16')](_0xf9c5('0x17'),_0x1ddbe5,_0x8c436['name']);_0x5c7ae1[_0xf9c5('0xa')]();}}}catch(_0x2ae394){console[_0xf9c5('0x18')](_0x2ae394);logger[_0xf9c5('0x16')]('[%s][QUEUE]\x20%s',_0x1ddbe5,_0x2ae394[_0xf9c5('0x19')]);_0x5c7ae1[_0xf9c5('0xa')]();}};};
\ No newline at end of file
+var _0x01ff=['timeout','createQueue','atimeout','channel','format','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','../../../../config/logger','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','join','stop','find','agents'];(function(_0x367b37,_0xecb6d9){var _0x56776b=function(_0x87b0d6){while(--_0x87b0d6){_0x367b37['push'](_0x367b37['shift']());}};_0x56776b(++_0xecb6d9);}(_0x01ff,0x167));var _0xf01f=function(_0x42ccd8,_0x204285){_0x42ccd8=_0x42ccd8-0x0;var _0x54334a=_0x01ff[_0x42ccd8];return _0x54334a;};'use strict';var schema=require(_0xf01f('0x0'));var _=require(_0xf01f('0x1'));var util=require(_0xf01f('0x2'));var seqqueue=require('seq-queue');var logger=require(_0xf01f('0x3'))(_0xf01f('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0xf01f('0x5'),'required':!![],'message':_0xf01f('0x6')},'timeout':{'type':_0xf01f('0x7'),'message':_0xf01f('0x8')}});function writeLog(_0xfa4041,_0x57a4ed,_0x4125e3){return logger[_0xf01f('0x9')](util['format'](_0xf01f('0xa'),_0xfa4041,_0x57a4ed[_0xf01f('0xb')],_0x4125e3));}function handleFindAgent(_0x1a8498){return function(_0x514ac7){return _0x514ac7[_0xf01f('0xb')][_0xf01f('0xc')]()===_0x1a8498[_0xf01f('0xc')]();};}exports[_0xf01f('0xd')]=function(_0x52c3f4,_0x511693,_0x28d559,_0xdf6981){return function(_0x19b1ec){try{var _0x30f74f={'name':_0x511693[0x0],'timeout':_0x511693[0x1]};var _0x114834=queue[_0xf01f('0x0')](_0x30f74f,{'typecast':!![]});if(_0x114834[_0xf01f('0xe')]){logger[_0xf01f('0xf')](_0xf01f('0x10'),_0x52c3f4,_['map'](_0x114834,'message')[_0xf01f('0x11')](',\x20'));_0x19b1ec[_0xf01f('0x12')]();}else{var _0x747494=_[_0xf01f('0x13')](_0x28d559[_0xf01f('0x14')],handleFindAgent(_0x30f74f[_0xf01f('0xb')]));if(_0x747494){var _0x473241=(_0x30f74f[_0xf01f('0x15')]||0xa)*0x3e8;var _0x2f8293,_0x35eb3b;var _0x30772d=seqqueue[_0xf01f('0x16')](_0x473241);_0x30772d['id']=_0x52c3f4;_0x30772d[_0xf01f('0x17')]=_0x473241;_0x30772d[_0xf01f('0x18')]=_0xdf6981[_0xf01f('0x18')];writeLog(_0x52c3f4,_0x747494,util[_0xf01f('0x19')]('START:%s',_0x473241));_0x28d559[_0xf01f('0x1a')][_0x52c3f4]['on'](_0xf01f('0x1b'),function(){logger[_0xf01f('0x9')](_0xf01f('0x1c'),_0x52c3f4);clearTimeout(_0x35eb3b);_0x35eb3b=undefined;_0x30772d[_0xf01f('0x1d')]();if(_0x28d559[_0xf01f('0x1a')][_0x52c3f4]){delete _0x28d559[_0xf01f('0x1a')][_0x52c3f4];}_0x19b1ec['stop']();});_0x28d559[_0xf01f('0x1a')][_0x52c3f4]['on'](_0xf01f('0x1e'),function(){if(_0x28d559[_0xf01f('0x1a')][_0x52c3f4]){delete _0x28d559[_0xf01f('0x1a')][_0x52c3f4];}});_0x35eb3b=setTimeout(function(){logger['info'](_0xf01f('0x1f'),_0x52c3f4);clearTimeout(_0x35eb3b);_0x30772d[_0xf01f('0x1d')]();_0x19b1ec[_0xf01f('0x20')]();},_0x473241);strategy[_0xf01f('0x21')](_0x30772d,_0x747494,_0x28d559,_0xdf6981);}else{logger[_0xf01f('0xf')](_0xf01f('0x22'),_0x52c3f4,_0x30f74f[_0xf01f('0xb')]);_0x19b1ec[_0xf01f('0x12')]();}}}catch(_0x5664e0){console[_0xf01f('0x23')](_0x5664e0);logger[_0xf01f('0xf')](_0xf01f('0x24'),_0x52c3f4,_0x5664e0[_0xf01f('0x25')]);_0x19b1ec[_0xf01f('0x12')]();}};};
\ No newline at end of file