Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
byit-myth-job
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liyuan
byit-myth-job
Commits
b5f4d2e2
Commit
b5f4d2e2
authored
Jul 10, 2020
by
huangfusuper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
JAVA节点支持 日志信息推送
parent
a7f371ca
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
47 additions
and
2 deletions
+47
-2
ApiNodeServiceImpl.java
...c/main/java/com/byit/service/impl/ApiNodeServiceImpl.java
+0
-1
JavaTaskJobTask.java
...min-core/src/main/java/com/byit/task/JavaTaskJobTask.java
+25
-0
JavaTask.java
...-dto-core/src/main/java/com/byit/dto/plugin/JavaTask.java
+5
-0
JobUtils.java
...xecutor-plugin/src/main/java/com/byit/utils/JobUtils.java
+1
-1
CommunicationParam.java
...mmon/src/main/java/com/byit/param/CommunicationParam.java
+16
-0
No files found.
byit-myth-admin/src/main/java/com/byit/service/impl/ApiNodeServiceImpl.java
View file @
b5f4d2e2
...
@@ -208,7 +208,6 @@ public class ApiNodeServiceImpl implements ApiNodeService {
...
@@ -208,7 +208,6 @@ public class ApiNodeServiceImpl implements ApiNodeService {
if
(
null
!=
javaTask
.
getAlarmlAction
()
&&
"0"
.
equals
(
javaTask
.
getRepeatCount
())){
if
(
null
!=
javaTask
.
getAlarmlAction
()
&&
"0"
.
equals
(
javaTask
.
getRepeatCount
())){
ValidationUtil
.
dataNotBank
(
javaTask
.
getAlarmEmail
(),
"设置为告警时告警邮箱不允许为空"
);
ValidationUtil
.
dataNotBank
(
javaTask
.
getAlarmEmail
(),
"设置为告警时告警邮箱不允许为空"
);
}
}
TimerTask
timerTask
=
new
JavaTaskJobTask
(
javaTask
);
TimerTask
timerTask
=
new
JavaTaskJobTask
(
javaTask
);
WorkRoulette
.
addJob
(
timerTask
,
System
.
currentTimeMillis
());
WorkRoulette
.
addJob
(
timerTask
,
System
.
currentTimeMillis
());
}
}
...
...
byit-myth-core/myth-admin-core/src/main/java/com/byit/task/JavaTaskJobTask.java
View file @
b5f4d2e2
package
com
.
byit
.
task
;
package
com
.
byit
.
task
;
import
com.alibaba.fastjson.JSON
;
import
com.byit.conf.MythJobAutoConfigure
;
import
com.byit.conf.MythJobAutoConfigure
;
import
com.byit.dto.plugin.JavaTask
;
import
com.byit.dto.plugin.JavaTask
;
import
com.byit.dto.plugin.RunLog
;
import
com.byit.enums.NodeRunStatusPropertyEnum
;
import
com.byit.enums.NodeRunStatusPropertyEnum
;
import
com.byit.enums.ScheduleTypeEnum
;
import
com.byit.enums.ScheduleTypeEnum
;
import
com.byit.enums.task.RunResultEnum
;
import
com.byit.enums.task.RunResultEnum
;
...
@@ -15,9 +17,13 @@ import com.byit.util.ServiceInfoUtil;
...
@@ -15,9 +17,13 @@ import com.byit.util.ServiceInfoUtil;
import
com.byit.util.SpringUtil
;
import
com.byit.util.SpringUtil
;
import
io.netty.util.Timeout
;
import
io.netty.util.Timeout
;
import
io.netty.util.TimerTask
;
import
io.netty.util.TimerTask
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
java.util.Date
;
import
java.util.Date
;
import
static
com
.
alibaba
.
fastjson
.
serializer
.
SerializerFeature
.
WriteClassName
;
/**
/**
* java节点的执行器
* java节点的执行器
* @author huangfu
* @author huangfu
...
@@ -37,6 +43,7 @@ public class JavaTaskJobTask implements TimerTask {
...
@@ -37,6 +43,7 @@ public class JavaTaskJobTask implements TimerTask {
}
}
private
void
runJob
(){
private
void
runJob
(){
String
noticeKey
=
javaTask
.
getNoticeKey
();
RunJavaServiceImpl
service
=
SpringUtil
.
getBean
(
RunJavaServiceImpl
.
class
);
RunJavaServiceImpl
service
=
SpringUtil
.
getBean
(
RunJavaServiceImpl
.
class
);
PluginRpcRequestPacket
request
=
new
PluginRpcRequestPacket
();
PluginRpcRequestPacket
request
=
new
PluginRpcRequestPacket
();
//保存到日志
//保存到日志
...
@@ -49,6 +56,9 @@ public class JavaTaskJobTask implements TimerTask {
...
@@ -49,6 +56,9 @@ public class JavaTaskJobTask implements TimerTask {
communicationParam
.
setLogId
(
logId
+
""
);
communicationParam
.
setLogId
(
logId
+
""
);
communicationParam
.
setCallbackUrl
(
callbackUrl
);
communicationParam
.
setCallbackUrl
(
callbackUrl
);
communicationParam
.
setBody
(
javaTask
.
getParam
());
communicationParam
.
setBody
(
javaTask
.
getParam
());
if
(
StringUtils
.
isNoneBlank
(
noticeKey
))
{
communicationParam
.
setExpand1
(
noticeKey
);
}
request
.
setParam
(
communicationParam
);
request
.
setParam
(
communicationParam
);
request
.
setJobName
(
javaTask
.
getTaskName
());
request
.
setJobName
(
javaTask
.
getTaskName
());
...
@@ -63,11 +73,26 @@ public class JavaTaskJobTask implements TimerTask {
...
@@ -63,11 +73,26 @@ public class JavaTaskJobTask implements TimerTask {
}
}
log
.
setTriggerMsg
(
pluginRpcResponsePacket
.
getMsg
());
log
.
setTriggerMsg
(
pluginRpcResponsePacket
.
getMsg
());
log
.
setJobGroupIp
(
pluginRpcResponsePacket
.
getRunIp
());
log
.
setJobGroupIp
(
pluginRpcResponsePacket
.
getRunIp
());
//如果需要通知redis
if
(
StringUtils
.
isNoneBlank
(
noticeKey
))
{
StringRedisTemplate
stringRedisTemplate
=
(
StringRedisTemplate
)
SpringUtil
.
getBean
(
"stringRedisTemplate"
);
RunLog
runLog
=
RunLog
.
builder
().
isEnd
(
false
).
isSuccess
(
true
).
runLog
(
"资源调用成功!"
).
build
();
stringRedisTemplate
.
opsForList
().
rightPush
(
noticeKey
,
JSON
.
toJSONString
(
runLog
,
WriteClassName
));
}
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
log
.
setTriggerCode
(
RunResultEnum
.
TRIGGER_ERROR
.
getCode
());
log
.
setTriggerCode
(
RunResultEnum
.
TRIGGER_ERROR
.
getCode
());
log
.
setRunCode
(
RunResultEnum
.
RUN_ERROR
.
getCode
());
log
.
setRunCode
(
RunResultEnum
.
RUN_ERROR
.
getCode
());
log
.
setRunMsg
(
javaTask
.
getTaskName
()+
":"
+
e
.
getMessage
());
log
.
setRunMsg
(
javaTask
.
getTaskName
()+
":"
+
e
.
getMessage
());
log
.
setTriggerMsg
(
javaTask
.
getTaskName
()+
":"
+
e
.
getMessage
());
log
.
setTriggerMsg
(
javaTask
.
getTaskName
()+
":"
+
e
.
getMessage
());
//如果需要通知redis
if
(
StringUtils
.
isNoneBlank
(
noticeKey
))
{
StringRedisTemplate
stringRedisTemplate
=
(
StringRedisTemplate
)
SpringUtil
.
getBean
(
"stringRedisTemplate"
);
RunLog
runLog
=
RunLog
.
builder
().
isEnd
(
true
).
isSuccess
(
false
).
runLog
(
"执行资源异常"
+
javaTask
.
getTaskName
()+
":"
+
e
.
getMessage
()).
build
();
stringRedisTemplate
.
opsForList
().
rightPush
(
noticeKey
,
JSON
.
toJSONString
(
runLog
,
WriteClassName
));
}
}
}
JobTaskRunLogServiceImpl
jobTaskRunLogService
=
SpringUtil
.
getBean
(
JobTaskRunLogServiceImpl
.
class
);
JobTaskRunLogServiceImpl
jobTaskRunLogService
=
SpringUtil
.
getBean
(
JobTaskRunLogServiceImpl
.
class
);
jobTaskRunLogService
.
updateJobTaskRunLogWithBLOBs
(
log
);
jobTaskRunLogService
.
updateJobTaskRunLogWithBLOBs
(
log
);
...
...
byit-myth-core/myth-dto-core/src/main/java/com/byit/dto/plugin/JavaTask.java
View file @
b5f4d2e2
...
@@ -86,6 +86,11 @@ public class JavaTask implements Serializable {
...
@@ -86,6 +86,11 @@ public class JavaTask implements Serializable {
private
String
jobType
;
private
String
jobType
;
/**
/**
* 通知主键
*/
private
String
noticeKey
;
/**
*/
*/
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
}
}
byit-myth-executor/myth-executor-plugin/src/main/java/com/byit/utils/JobUtils.java
View file @
b5f4d2e2
...
@@ -159,7 +159,7 @@ public class JobUtils {
...
@@ -159,7 +159,7 @@ public class JobUtils {
*/
*/
private
static
final
String
REQUEST_LOADSTATUS_JAVATASK
=
"/api/node/loadCurrentStatusByJobName"
;
private
static
final
String
REQUEST_LOADSTATUS_JAVATASK
=
"/api/node/loadCurrentStatusByJobName"
;
private
static
final
String
STOP_SCHEDULE_BY_RUNID
=
"/api/flow/stopScheduleByRunId"
;
private
static
final
String
STOP_SCHEDULE_BY_RUNID
=
"/api/flow/stopScheduleByRunId"
;
/**
/*
J
*
* 当前项目运行环境 jar file
* 当前项目运行环境 jar file
*/
*/
private
static
final
String
OPERATING_ENVIRONMENT_JAR
=
"jar"
;
private
static
final
String
OPERATING_ENVIRONMENT_JAR
=
"jar"
;
...
...
byit-plugin-core/byit-plugin-rpc-common/src/main/java/com/byit/param/CommunicationParam.java
View file @
b5f4d2e2
...
@@ -22,4 +22,20 @@ public class CommunicationParam implements Serializable {
...
@@ -22,4 +22,20 @@ public class CommunicationParam implements Serializable {
* 服务端参数
* 服务端参数
*/
*/
private
String
body
;
private
String
body
;
/**
* 扩展字段1
*/
private
String
expand1
;
/**
* 扩展字段2
*/
private
String
expand2
;
/**
* 扩展字段3
*/
private
String
expand3
;
/**
* 扩展字段4
*/
private
String
expand4
;
}
}
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