From 055b071348e3e506508567ad3ce153706955386b Mon Sep 17 00:00:00 2001 From: qrfxiaoge Date: Wed, 18 Sep 2019 11:47:41 +0800 Subject: [PATCH] bugfix-user-specified queue takes precedence over tenant queue (#769) Solve the problem that the user queue setting does not take effect --- .../src/main/java/cn/escheduler/dao/ProcessDao.java | 2 +- .../cn/escheduler/server/worker/runner/FetchTaskThread.java | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/escheduler-dao/src/main/java/cn/escheduler/dao/ProcessDao.java b/escheduler-dao/src/main/java/cn/escheduler/dao/ProcessDao.java index ee0dd48575..73ae868c80 100644 --- a/escheduler-dao/src/main/java/cn/escheduler/dao/ProcessDao.java +++ b/escheduler-dao/src/main/java/cn/escheduler/dao/ProcessDao.java @@ -1739,7 +1739,7 @@ public class ProcessDao extends AbstractBaseDao { * @param processInstanceId * @return */ - public String queryQueueByProcessInstanceId(int processInstanceId){ + public String queryUserQueueByProcessInstanceId(int processInstanceId){ return userMapper.queryQueueByProcessInstanceId(processInstanceId); } diff --git a/escheduler-server/src/main/java/cn/escheduler/server/worker/runner/FetchTaskThread.java b/escheduler-server/src/main/java/cn/escheduler/server/worker/runner/FetchTaskThread.java index 31c4def1da..07ca740d24 100644 --- a/escheduler-server/src/main/java/cn/escheduler/server/worker/runner/FetchTaskThread.java +++ b/escheduler-server/src/main/java/cn/escheduler/server/worker/runner/FetchTaskThread.java @@ -187,8 +187,9 @@ public class FetchTaskThread implements Runnable{ continue; } - // set queue for process instance - taskInstance.getProcessInstance().setQueue(tenant.getQueue()); + // set queue for process instance, user-specified queue takes precedence over tenant queue + String userQueue = processDao.queryUserQueueByProcessInstanceId(taskInstance.getProcessInstanceId()); + taskInstance.getProcessInstance().setQueue(StringUtils.isEmpty(userQueue) ? tenant.getQueue() : userQueue); logger.info("worker fetch taskId : {} from queue ", taskInstId);