parent
7c98924141
commit
7d11f02b28
4 changed files with 88 additions and 0 deletions
@ -0,0 +1,30 @@ |
|||||||
|
package org.springblade.job.processor.produce; |
||||||
|
|
||||||
|
import jakarta.annotation.Resource; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.springblade.desk.produce.feign.IDisTaskingClient; |
||||||
|
import org.springframework.stereotype.Component; |
||||||
|
import tech.powerjob.worker.core.processor.ProcessResult; |
||||||
|
import tech.powerjob.worker.core.processor.TaskContext; |
||||||
|
import tech.powerjob.worker.core.processor.sdk.BasicProcessor; |
||||||
|
|
||||||
|
/** |
||||||
|
* 调度任务同步 |
||||||
|
* |
||||||
|
* @author litao |
||||||
|
*/ |
||||||
|
@Component |
||||||
|
@Data |
||||||
|
@Slf4j |
||||||
|
public class DisTaskingProcessor implements BasicProcessor { |
||||||
|
|
||||||
|
@Resource |
||||||
|
private IDisTaskingClient client; |
||||||
|
|
||||||
|
@Override |
||||||
|
public ProcessResult process(TaskContext context) throws Exception { |
||||||
|
log.info("调度任务同步开始"); |
||||||
|
return new ProcessResult(client.syncDisTasking()); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,29 @@ |
|||||||
|
package org.springblade.desk.produce.feign; |
||||||
|
|
||||||
|
import org.springblade.core.launch.constant.AppConstant; |
||||||
|
import org.springframework.cloud.openfeign.FeignClient; |
||||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||||
|
|
||||||
|
/** |
||||||
|
* 调度任务同步接口 |
||||||
|
* |
||||||
|
* @author litao |
||||||
|
*/ |
||||||
|
@FeignClient( |
||||||
|
value = AppConstant.APPLICATION_DESK_NAME |
||||||
|
) |
||||||
|
public interface IDisTaskingClient { |
||||||
|
|
||||||
|
String API_PREFIX = "/feign/client/disTasking"; |
||||||
|
|
||||||
|
String SYNC_DIS_TASKING = API_PREFIX + "/syncDisTasking"; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 调度任务同步接口 |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@GetMapping(SYNC_DIS_TASKING) |
||||||
|
boolean syncDisTasking(); |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,26 @@ |
|||||||
|
package org.springblade.desk.produce.feign; |
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.Hidden; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springblade.core.tenant.annotation.NonDS; |
||||||
|
import org.springblade.desk.produce.service.IDisTaskingService; |
||||||
|
import org.springframework.web.bind.annotation.RestController; |
||||||
|
|
||||||
|
/** |
||||||
|
* Feign 调度任务同步接口 |
||||||
|
* |
||||||
|
* @author litao |
||||||
|
*/ |
||||||
|
@NonDS |
||||||
|
@Hidden() |
||||||
|
@RestController |
||||||
|
@RequiredArgsConstructor |
||||||
|
public class DisTaskingClient implements IDisTaskingClient { |
||||||
|
|
||||||
|
private final IDisTaskingService disTaskingService; |
||||||
|
|
||||||
|
@Override |
||||||
|
public boolean syncDisTasking() { |
||||||
|
return disTaskingService.syncDisTasking(false); |
||||||
|
} |
||||||
|
} |
||||||
Loading…
Reference in new issue