抖店消息处理
parent
29281507e2
commit
47386f031c
@ -0,0 +1,27 @@
|
||||
package com.ms.api.spi.timer;
|
||||
|
||||
import com.jinritemai.cloud.base.api.BaseRequest;
|
||||
import com.jinritemai.cloud.base.api.BaseResponse;
|
||||
import com.jinritemai.cloud.base.api.ExtensionService;
|
||||
import com.jinritemai.cloud.base.api.ExtensionServiceHandler;
|
||||
import com.ms.api.common.R;
|
||||
import com.ms.api.common.Ret;
|
||||
import com.ms.api.common.TimerBaseService;
|
||||
import com.ms.api.dto.ItemDTO;
|
||||
import com.ms.api.task.UnlockDoudianMsgTimeoutQueueTaskService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@ExtensionService("unlockDoudianMsgTimeoutQueueTimer")
|
||||
@Slf4j
|
||||
public class UnlockDoudianMsgTimeoutQueueTimerService extends TimerBaseService implements ExtensionServiceHandler<ItemDTO, Ret> {
|
||||
|
||||
@Autowired
|
||||
private UnlockDoudianMsgTimeoutQueueTaskService unlockDoudianMsgTimeoutQueueTaskService;
|
||||
|
||||
@Override
|
||||
public BaseResponse<Ret> handle(BaseRequest<ItemDTO> req) {
|
||||
unlockDoudianMsgTimeoutQueueTaskService.runTask();
|
||||
return R.ok(Ret.success());
|
||||
}
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
package com.ms.api.task;
|
||||
|
||||
import com.ms.api.common.TaskBaseService;
|
||||
import com.ms.api.consts.TblConst;
|
||||
import com.ms.api.service.QueueService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
@Configuration
|
||||
@Component
|
||||
@Slf4j
|
||||
public class UnlockDoudianMsgTimeoutQueueTaskService extends TaskBaseService {
|
||||
@Autowired
|
||||
private QueueService queueService;
|
||||
|
||||
/**
|
||||
* 同时开启任务处理数量
|
||||
*/
|
||||
public int getCorePoolSiz() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
/**
|
||||
* 任务管理器名称
|
||||
*/
|
||||
public String getTaskExecutorName() {
|
||||
return "unlockDoudianMsgTimeoutQueueTaskPool";
|
||||
}
|
||||
|
||||
@Bean(name = "unlockDoudianMsgTimeoutQueueTaskPool")
|
||||
@Override
|
||||
public Executor getAsyncExecutor() {
|
||||
return super.getAsyncExecutor();
|
||||
}
|
||||
|
||||
@Resource(name = "unlockDoudianMsgTimeoutQueueTaskPool")
|
||||
protected Executor taskPool;
|
||||
|
||||
@Override
|
||||
protected Executor getTaskPool() {
|
||||
return taskPool;
|
||||
}
|
||||
|
||||
@Async("unlockDoudianMsgTimeoutQueueTaskPool")
|
||||
@Override
|
||||
public void runTask() {
|
||||
super.runTask();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getTask() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object processTask(Object params) {
|
||||
if (params == null) {
|
||||
return null;
|
||||
}
|
||||
queueService.unlockTimeoutSolidRedisQueue(TblConst.doudian_aftersale_msg_queue, 300, null);
|
||||
queueService.unlockTimeoutSolidRedisQueue(TblConst.doudian_trade_msg_queue, 300, null);
|
||||
queueService.unlockTimeoutQueue(TblConst.doudian_msg_parse_queue, 300, null);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearTask(Object params) {
|
||||
if (params == null) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue