REQ-3284: 推送消息
This commit is contained in:
parent
c9ae2da91e
commit
14115bbc66
@ -0,0 +1,28 @@
|
||||
package cn.axzo.im.job;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xxl.job.core.biz.model.ReturnT;
|
||||
import com.xxl.job.core.executor.XxlJobExecutor;
|
||||
import com.xxl.job.core.handler.IJobHandler;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @author yanglin
|
||||
*/
|
||||
@RestController
|
||||
public class JobHttpHandler {
|
||||
|
||||
@PostMapping("/jobs/{jobName}")
|
||||
ReturnT<String> exec(@PathVariable String jobName,
|
||||
@RequestBody(required = false) JSONObject paramObj) throws Exception {
|
||||
IJobHandler jobHandler = XxlJobExecutor.loadJobHandler(jobName);
|
||||
if (jobHandler == null)
|
||||
return new ReturnT<>(ReturnT.FAIL_CODE, String.format("找不到job: %s", jobName));
|
||||
jobHandler.execute(paramObj == null? null : paramObj.toJSONString());
|
||||
return ReturnT.SUCCESS;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user