Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
280bf159
Commit
280bf159
authored
Jul 21, 2020
by
宋毅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tj
parent
5a2c0822
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
24 additions
and
15 deletions
+24
-15
brg-queue-center/app/base/api/api.base.js
+5
-4
brg-queue-center/app/base/api/impl/queueAction/producer.js
+3
-0
brg-queue-center/app/base/db/consumer/publicServiceAllocation/publicConsumer.js
+1
-2
brg-queue-center/app/base/utils/esUtils.js
+7
-3
brg-queue-center/app/config/settings.js
+2
-2
brg-queue-center/readme.txt
+6
-4
No files found.
brg-queue-center/app/base/api/api.base.js
View file @
280bf159
...
...
@@ -16,6 +16,7 @@ class APIBase {
if
(
!
pobj
.
actionBody
)
{
pobj
.
actionBody
=
{};
}
pobj
.
actionBody
.
requestId
=
pobj
.
requestId
?
pobj
.
requestId
:
pobj
.
actionBody
.
requestId
||
await
this
.
getBusUid
(
"mq-"
);
var
shaStr
=
await
sha256
(
JSON
.
stringify
(
pobj
));
this
.
redisClient
.
setWithEx
(
shaStr
,
1
,
3
);
var
result
=
await
this
[
methodname
](
pobj
,
query
,
req
);
...
...
@@ -23,13 +24,13 @@ class APIBase {
result
=
system
.
getResult
(
null
,
"请求的方法返回值为空"
);
}
if
(
!
result
.
requestId
)
{
result
.
requestId
=
pobj
.
actionBody
.
requestId
||
await
this
.
getBusUid
(
"scz"
)
;
result
.
requestId
=
pobj
.
actionBody
.
requestId
;
}
if
(
"LOGS-SYTXPUBLIC-MSGQ"
!=
settings
.
queuedName
)
{
pobj
.
actionBody
.
resultInfo
=
result
;
pobj
.
actionBody
.
requestId
=
result
.
requestId
;
pobj
.
actionBody
.
opTitle
=
"reqPath:"
+
req
.
path
;
this
.
esUtils
.
addEsLogs
(
settings
.
queuedName
+
"
api-req"
,
pobj
);
this
.
esUtils
.
addEsLogs
(
settings
.
queuedName
+
"
-apireq"
,
pobj
.
actionBody
);
}
return
result
;
}
catch
(
error
)
{
...
...
@@ -38,8 +39,8 @@ class APIBase {
var
rtnerror
=
system
.
getResultFail
(
-
200
,
"出现异常,error:"
+
stackStr
);
pobj
.
actionBody
.
requestId
=
pobj
.
actionBody
.
requestId
||
await
this
.
getBusUid
(
"err"
);
pobj
.
actionBody
.
errorInfo
=
stackStr
;
pobj
.
actionBody
.
opTitle
=
",reqPath:"
+
req
.
path
;
this
.
esUtils
.
addEsLogs
(
settings
.
queuedName
+
"
apidoexec-error"
,
pobj
);
pobj
.
actionBody
.
opTitle
=
"
请求出现异常
,reqPath:"
+
req
.
path
;
this
.
esUtils
.
addEsLogs
(
settings
.
queuedName
+
"
-apireq"
,
pobj
.
actionBody
);
return
rtnerror
;
}
}
...
...
brg-queue-center/app/base/api/impl/queueAction/producer.js
View file @
280bf159
...
...
@@ -24,6 +24,9 @@ class ProducerAPI extends APIBase {
var
opResult
=
null
;
switch
(
actionType
)
{
case
"produceData"
:
if
(
settings
.
queuedName
!=
"SYTXPUBLIC-MSGQ"
)
{
return
system
.
getResult
(
null
,
"请求地址有误!"
);
}
opResult
=
await
this
.
utilsProduceSve
.
produceData
(
pobj
,
req
);
break
;
case
"produceLogsData"
:
...
...
brg-queue-center/app/base/db/consumer/publicServiceAllocation/publicConsumer.js
View file @
280bf159
...
...
@@ -17,8 +17,7 @@ class PublicConsumer extends ConsumerBase {
requestId
:
actionBody
.
requestId
}
console
.
log
(
JSON
.
stringify
(
params
),
"publicConsumer-->subDoConsumer...pushurl="
+
actionBody
.
pushUrl
);
var
execResult
=
await
this
.
execPostByTimeOut
(
params
,
actionBody
.
pushUrl
);
console
.
log
(
JSON
.
stringify
(
execResult
),
"publicConsumer-->subDoConsumer.....结果......pushurl="
+
actionBody
.
pushUrl
);
var
execResult
=
await
this
.
execPostByTimeOut
(
params
,
actionBody
.
pushUrl
,
null
,
null
,
5
);
var
tmpBody
=
{
"opTitle"
:
"队列推送数据记录,推送地址:"
+
actionBody
.
pushUrl
,
// N 操作的业务标题
"identifyCode"
:
actionBody
.
identifyCode
||
""
,
// Y 操作的业务标识
...
...
brg-queue-center/app/base/utils/esUtils.js
View file @
280bf159
...
...
@@ -26,8 +26,12 @@ class EsUtils {
actionBody
.
messageBody
=
actionBody
.
messageBody
+
";actionType="
+
(
actionBody
.
actionType
||
""
)
+
";pushUrl="
+
(
actionBody
.
pushUrl
||
""
);
}
if
(
typeof
actionBody
.
messageBody
===
'object'
)
{
actionBody
.
messageBody
.
actionType
=
actionBody
.
actionType
||
""
;
actionBody
.
messageBody
.
pushUrl
=
actionBody
.
pushUrl
||
""
;
if
(
!
actionBody
.
messageBody
.
actionType
)
{
actionBody
.
messageBody
.
actionType
=
actionBody
.
actionType
||
""
;
}
if
(
!
actionBody
.
messageBody
.
pushUrl
)
{
actionBody
.
messageBody
.
pushUrl
=
actionBody
.
pushUrl
||
""
;
}
}
actionBody
.
messageBody
=
typeof
actionBody
.
messageBody
===
'object'
?
JSON
.
stringify
(
actionBody
.
messageBody
)
:
actionBody
.
messageBody
||
""
;
var
params
=
{
...
...
@@ -92,7 +96,7 @@ class EsUtils {
return
system
.
getResult
(
null
,
"execPostTimeOut data is empty"
);
}
var
stdoutInfo
=
JSON
.
parse
(
result
.
stdout
);
if
(
stdoutInfo
.
error
&&
stdoutInfo
.
error
.
reason
===
"no such index"
)
{
if
(
stdoutInfo
.
error
&&
stdoutInfo
.
error
.
reason
===
"no such index"
)
{
return
system
.
getResult
(
null
,
"no such index info"
);
}
if
(
stdoutInfo
.
error
)
{
...
...
brg-queue-center/app/config/settings.js
View file @
280bf159
...
...
@@ -10,8 +10,8 @@ var ENVINPUT = {
REDIS_DB
:
process
.
env
.
QUEUE_REDIS_DB
,
DB_NAME
:
process
.
env
.
QUEUE_DB_NAME
,
APP_ENV
:
process
.
env
.
APP_ENV
?
process
.
env
.
APP_ENV
:
"test"
,
//运行环境
CONSUMER_NAME
:
process
.
env
.
CONSUMER_NAME
||
"public
Logs.publicLogs
Consumer"
,
//消费者名称
QUEUED_NAME
:
process
.
env
.
QUEUED_NAME
||
"
LOGS-
SYTXPUBLIC-MSGQ"
,
//队列名称,FAIL-失败队列(队列和失败队列一对存在进行部署)
CONSUMER_NAME
:
process
.
env
.
CONSUMER_NAME
||
"public
ServiceAllocation.public
Consumer"
,
//消费者名称
QUEUED_NAME
:
process
.
env
.
QUEUED_NAME
||
"SYTXPUBLIC-MSGQ"
,
//队列名称,FAIL-失败队列(队列和失败队列一对存在进行部署)
};
var
settings
=
{
env
:
ENVINPUT
.
APP_ENV
,
...
...
brg-queue-center/readme.txt
View file @
280bf159
...
...
@@ -31,7 +31,8 @@
"name":"张三",
"age":21
}
}
},
"requestId":"PUB-202006111530vbot" // N 请求id
}
1.(1) 推送地址:http://60.205.209.94:4012/web/auth/channelAccessAuth/springBoard
参数:
...
...
@@ -42,7 +43,7 @@
"name":"张三",
"age":21
},
"requestId":"PUB-202006111530vbot"
"requestId":"PUB-202006111530vbot"
// N 请求id
}
返回参数:
{
...
...
@@ -66,7 +67,7 @@
data: null//业务处理返回
}
},
"requestId":"PUB-202006111530vbot"
"requestId":"PUB-202006111530vbot"
// N 请求id
}
返回参数:
{
...
...
@@ -91,7 +92,8 @@
},
"resultInfo":"",//返回信息
"errorInfo": ""//错误信息
}
},
"requestId":"PUB-202006111530vbot" // N 请求id
}
返回参数:
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment