Built motion from commit 6a09e18b.|2.6.11
[motion2.git] / server / services / routing / server / applications / agent.js
index 9d91d8f..df04bc2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x685f=['toLowerCase','consequence','validate','length','error','[%s][AGENT]\x20%s','message','stop','timeout','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','[%s][AGENT]\x20ROUTING\x20END','next','agent','log','[%s][QUEUE]\x20%s','lodash','util','seq-queue','routing','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name'];(function(_0x1bbc08,_0x444008){var _0x5d825b=function(_0x522920){while(--_0x522920){_0x1bbc08['push'](_0x1bbc08['shift']());}};_0x5d825b(++_0x444008);}(_0x685f,0x180));var _0xf685=function(_0x4b66bf,_0x581149){_0x4b66bf=_0x4b66bf-0x0;var _0x547ff4=_0x685f[_0x4b66bf];return _0x547ff4;};'use strict';var schema=require('validate');var _=require(_0xf685('0x0'));var util=require(_0xf685('0x1'));var seqqueue=require(_0xf685('0x2'));var logger=require('../../../../config/logger')(_0xf685('0x3'));var strategy=require(_0xf685('0x4'));var queue=schema({'name':{'type':'string','required':!![],'message':_0xf685('0x5')},'timeout':{'type':_0xf685('0x6'),'message':_0xf685('0x7')}});function writeLog(_0x141b3c,_0x321c34,_0x355538){return logger[_0xf685('0x8')](util[_0xf685('0x9')](_0xf685('0xa'),_0x141b3c,_0x321c34[_0xf685('0xb')],_0x355538));}function handleFindAgent(_0x28f713){return function(_0x2eee79){return _0x2eee79['name'][_0xf685('0xc')]()===_0x28f713[_0xf685('0xc')]();};}exports[_0xf685('0xd')]=function(_0x14cc46,_0x2e85c0,_0x1e6f31,_0x8eb10c){return function(_0x58b9cf){try{var _0x46d65c={'name':_0x2e85c0[0x0],'timeout':_0x2e85c0[0x1]};var _0xfefe58=queue[_0xf685('0xe')](_0x46d65c,{'typecast':!![]});if(_0xfefe58[_0xf685('0xf')]){logger[_0xf685('0x10')](_0xf685('0x11'),_0x14cc46,_['map'](_0xfefe58,_0xf685('0x12'))['join'](',\x20'));_0x58b9cf[_0xf685('0x13')]();}else{var _0x33ec40=_['find'](_0x1e6f31['agents'],handleFindAgent(_0x46d65c[_0xf685('0xb')]));if(_0x33ec40){var _0x11ecc1=(_0x46d65c[_0xf685('0x14')]||0xa)*0x3e8;var _0x493e4a,_0x1fc264;var _0x51a1c2=seqqueue['createQueue'](_0x11ecc1);_0x51a1c2['id']=_0x14cc46;_0x51a1c2[_0xf685('0x15')]=_0x11ecc1;_0x51a1c2[_0xf685('0x16')]=_0x8eb10c[_0xf685('0x16')];writeLog(_0x14cc46,_0x33ec40,util[_0xf685('0x9')](_0xf685('0x17'),_0x11ecc1));_0x1e6f31[_0xf685('0x18')][_0x14cc46]['on'](_0xf685('0x19'),function(){logger[_0xf685('0x8')](_0xf685('0x1a'),_0x14cc46);clearTimeout(_0x1fc264);_0x1fc264=undefined;_0x51a1c2[_0xf685('0x1b')]();if(_0x1e6f31[_0xf685('0x18')][_0x14cc46]){delete _0x1e6f31[_0xf685('0x18')][_0x14cc46];}_0x58b9cf[_0xf685('0x13')]();});_0x1e6f31[_0xf685('0x18')][_0x14cc46]['on']('complete',function(){if(_0x1e6f31[_0xf685('0x18')][_0x14cc46]){delete _0x1e6f31[_0xf685('0x18')][_0x14cc46];}});_0x1fc264=setTimeout(function(){logger['info'](_0xf685('0x1c'),_0x14cc46);clearTimeout(_0x1fc264);_0x51a1c2['close']();_0x58b9cf[_0xf685('0x1d')]();},_0x11ecc1);strategy[_0xf685('0x1e')](_0x51a1c2,_0x33ec40,_0x1e6f31,_0x8eb10c);}else{logger[_0xf685('0x10')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x14cc46,_0x46d65c[_0xf685('0xb')]);_0x58b9cf[_0xf685('0x13')]();}}}catch(_0x54f92f){console[_0xf685('0x1f')](_0x54f92f);logger['error'](_0xf685('0x20'),_0x14cc46,_0x54f92f['stack']);_0x58b9cf[_0xf685('0x13')]();}};};
\ No newline at end of file
+var _0xf243=['channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','[%s][AGENT]\x20ROUTING\x20END','close','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','format','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','createQueue'];(function(_0xc75c31,_0x160f4d){var _0x3e387d=function(_0x53ddbf){while(--_0x53ddbf){_0xc75c31['push'](_0xc75c31['shift']());}};_0x3e387d(++_0x160f4d);}(_0xf243,0x1d2));var _0x3f24=function(_0x44dcf0,_0x1402cd){_0x44dcf0=_0x44dcf0-0x0;var _0x206867=_0xf243[_0x44dcf0];return _0x206867;};'use strict';var schema=require(_0x3f24('0x0'));var _=require(_0x3f24('0x1'));var util=require(_0x3f24('0x2'));var seqqueue=require(_0x3f24('0x3'));var logger=require(_0x3f24('0x4'))(_0x3f24('0x5'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0x3f24('0x6'),'required':!![],'message':_0x3f24('0x7')},'timeout':{'type':'number','message':_0x3f24('0x8')}});function writeLog(_0x304ef7,_0x542744,_0x35c6b2){return logger[_0x3f24('0x9')](util[_0x3f24('0xa')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x304ef7,_0x542744[_0x3f24('0xb')],_0x35c6b2));}function handleFindAgent(_0x32978f){return function(_0x29f581){return _0x29f581[_0x3f24('0xb')][_0x3f24('0xc')]()===_0x32978f[_0x3f24('0xc')]();};}exports[_0x3f24('0xd')]=function(_0x48e6dd,_0x130f6f,_0x104645,_0x316b7b){return function(_0x5d6139){try{var _0xe23aec={'name':_0x130f6f[0x0],'timeout':_0x130f6f[0x1]};var _0x35ff67=queue['validate'](_0xe23aec,{'typecast':!![]});if(_0x35ff67[_0x3f24('0xe')]){logger[_0x3f24('0xf')](_0x3f24('0x10'),_0x48e6dd,_[_0x3f24('0x11')](_0x35ff67,_0x3f24('0x12'))[_0x3f24('0x13')](',\x20'));_0x5d6139[_0x3f24('0x14')]();}else{var _0x35faeb=_[_0x3f24('0x15')](_0x104645[_0x3f24('0x16')],handleFindAgent(_0xe23aec[_0x3f24('0xb')]));if(_0x35faeb){var _0x3f95fd=(_0xe23aec['timeout']||0xa)*0x3e8;var _0x36a332,_0x261add;var _0x2373b6=seqqueue[_0x3f24('0x17')](_0x3f95fd);_0x2373b6['id']=_0x48e6dd;_0x2373b6['atimeout']=_0x3f95fd;_0x2373b6['channel']=_0x316b7b[_0x3f24('0x18')];writeLog(_0x48e6dd,_0x35faeb,util[_0x3f24('0xa')](_0x3f24('0x19'),_0x3f95fd));_0x104645[_0x3f24('0x1a')][_0x48e6dd]['on'](_0x3f24('0x1b'),function(){logger[_0x3f24('0x9')](_0x3f24('0x1c'),_0x48e6dd);clearTimeout(_0x261add);_0x261add=undefined;_0x2373b6['close']();if(_0x104645[_0x3f24('0x1a')][_0x48e6dd]){delete _0x104645[_0x3f24('0x1a')][_0x48e6dd];}_0x5d6139['stop']();});_0x104645[_0x3f24('0x1a')][_0x48e6dd]['on']('complete',function(){if(_0x104645[_0x3f24('0x1a')][_0x48e6dd]){delete _0x104645[_0x3f24('0x1a')][_0x48e6dd];}});_0x261add=setTimeout(function(){logger['info'](_0x3f24('0x1d'),_0x48e6dd);clearTimeout(_0x261add);_0x2373b6[_0x3f24('0x1e')]();_0x5d6139['next']();},_0x3f95fd);strategy['agent'](_0x2373b6,_0x35faeb,_0x104645,_0x316b7b);}else{logger['error'](_0x3f24('0x1f'),_0x48e6dd,_0xe23aec[_0x3f24('0xb')]);_0x5d6139[_0x3f24('0x14')]();}}}catch(_0x2fad10){console[_0x3f24('0x20')](_0x2fad10);logger[_0x3f24('0xf')](_0x3f24('0x21'),_0x48e6dd,_0x2fad10[_0x3f24('0x22')]);_0x5d6139['stop']();}};};
\ No newline at end of file