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
a8ef595a
Commit
a8ef595a
authored
Apr 14, 2020
by
guominglei
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/developer' into developer
parents
b941669e
0f071701
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
2 deletions
+51
-2
pom.xml
byit-plugin-core/byit-plugin-rpc-common/pom.xml
+5
-0
TaskHandler.java
.../src/main/java/com/byit/task/annotations/TaskHandler.java
+1
-1
DefaultRemainingOperationsCallBack.java
...com/byit/callback/DefaultRemainingOperationsCallBack.java
+45
-1
No files found.
byit-plugin-core/byit-plugin-rpc-common/pom.xml
View file @
a8ef595a
...
@@ -64,5 +64,9 @@
...
@@ -64,5 +64,9 @@
<version>
4.0.38
</version>
<version>
4.0.38
</version>
</dependency>
</dependency>
<dependency>
<groupId>
cn.hutool
</groupId>
<artifactId>
hutool-all
</artifactId>
</dependency>
</dependencies>
</dependencies>
</project>
</project>
\ No newline at end of file
byit-plugin-core/byit-plugin-rpc-common/src/main/java/com/byit/task/annotations/TaskHandler.java
View file @
a8ef595a
...
@@ -49,7 +49,7 @@ public @interface TaskHandler {
...
@@ -49,7 +49,7 @@ public @interface TaskHandler {
/**
/**
* 当前工作流版本的告警的时机(0 不告警, 1 完成时告警, 2 失败时告警, 3 成功时告警)
* 当前工作流版本的告警的时机(0 不告警, 1 完成时告警, 2 失败时告警, 3 成功时告警)
*/
*/
String
alarmlAction
()
default
"
1
"
;
String
alarmlAction
()
default
"
0
"
;
String
sendEmail
()
default
""
;
String
sendEmail
()
default
""
;
}
}
byit-plugin-core/myth-plugin-rpc-server/src/main/java/com/byit/callback/DefaultRemainingOperationsCallBack.java
View file @
a8ef595a
package
com
.
byit
.
callback
;
package
com
.
byit
.
callback
;
import
cn.hutool.http.HttpUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.byit.dto.plugin.JavaTask
;
import
com.byit.dto.web.ResponseResult
;
import
com.byit.task.annotations.TaskHandler
;
import
com.byit.task.annotations.TaskHandler
;
import
com.byit.task.handler.interfaces.IJobHandler
;
import
com.byit.task.handler.interfaces.IJobHandler
;
import
org.apache.commons.lang3.StringUtils
;
import
java.util.Map
;
import
java.util.Map
;
import
static
com
.
alibaba
.
fastjson
.
serializer
.
SerializerFeature
.
WriteClassName
;
/**
/**
* 默认的后续处理器
* 默认的后续处理器
* @author huangfu
* @author huangfu
...
@@ -20,11 +27,48 @@ public class DefaultRemainingOperationsCallBack implements RemainingOperationsCa
...
@@ -20,11 +27,48 @@ public class DefaultRemainingOperationsCallBack implements RemainingOperationsCa
TaskHandler
annotation
=
nodeClass
.
getAnnotation
(
TaskHandler
.
class
);
TaskHandler
annotation
=
nodeClass
.
getAnnotation
(
TaskHandler
.
class
);
//如果是自动注册 就实现自动注册
//如果是自动注册 就实现自动注册
if
(
annotation
.
autoPublish
())
{
if
(
annotation
.
autoPublish
())
{
String
publishUrl
=
annotation
.
publishUrl
();
if
(
StringUtils
.
isNotBlank
(
publishUrl
))
{
JavaTask
javaTask
=
annotationParse
(
annotation
);
String
javaTaskJson
=
JSON
.
toJSONString
(
javaTask
,
WriteClassName
);
String
post
=
HttpUtil
.
post
(
publishUrl
,
javaTaskJson
);
ResponseResult
responseResult
=
JSON
.
parseObject
(
post
,
ResponseResult
.
class
);
String
msg
=
responseResult
.
getMsg
();
System
.
err
.
println
(
"------"
+
nodeClass
.
getName
()+
":"
+
msg
+
"-------------"
);
}
}
}
}
}
});
});
});
}).
start
();
}
/**
* 注解解析
* @param taskHandler
* @return
*/
private
JavaTask
annotationParse
(
TaskHandler
taskHandler
){
String
email
=
taskHandler
.
sendEmail
();
String
taskName
=
taskHandler
.
taskName
();
String
cron
=
taskHandler
.
cron
();
int
schedulingCount
=
taskHandler
.
schedulingCount
();
String
jobName
=
taskHandler
.
jobName
();
if
(
StringUtils
.
isBlank
(
jobName
))
{
jobName
=
taskName
;
}
String
alarmlAction
=
taskHandler
.
alarmlAction
();
JavaTask
javaTask
=
new
JavaTask
();
javaTask
.
setJobName
(
jobName
);
javaTask
.
setAlarmEmail
(
email
);
javaTask
.
setCron
(
cron
);
javaTask
.
setRepeatCount
(
schedulingCount
);
javaTask
.
setTaskName
(
taskName
);
javaTask
.
setAlarmlAction
(
alarmlAction
);
return
javaTask
;
}
}
}
}
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