mirror of
https://github.com/PowerJob/PowerJob.git
synced 2025-07-17 00:00:04 +08:00
feat: support method job direct return ProcessResult #798
This commit is contained in:
parent
4fe2d7fdf1
commit
4e84bc60d7
@ -24,6 +24,12 @@ class MethodBasicProcessor implements BasicProcessor {
|
|||||||
public ProcessResult process(TaskContext context) throws Exception {
|
public ProcessResult process(TaskContext context) throws Exception {
|
||||||
try {
|
try {
|
||||||
Object result = method.invoke(bean, context);
|
Object result = method.invoke(bean, context);
|
||||||
|
|
||||||
|
// 支持直接返回 ProcessResult https://github.com/PowerJob/PowerJob/issues/798
|
||||||
|
if (result instanceof ProcessResult) {
|
||||||
|
return (ProcessResult) result;
|
||||||
|
}
|
||||||
|
|
||||||
return new ProcessResult(true, JsonUtils.toJSONString(result));
|
return new ProcessResult(true, JsonUtils.toJSONString(result));
|
||||||
} catch (InvocationTargetException ite) {
|
} catch (InvocationTargetException ite) {
|
||||||
ExceptionUtils.rethrow(ite.getTargetException());
|
ExceptionUtils.rethrow(ite.getTargetException());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user