gong commented on code in PR #5080:
URL: https://github.com/apache/inlong/pull/5080#discussion_r922945287
##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/workflow/group/listener/InitGroupListener.java:
##########
@@ -15,60 +15,57 @@
* limitations under the License.
*/
-package org.apache.inlong.manager.service.workflow.group.listener.light;
+package org.apache.inlong.manager.service.workflow.group.listener;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
-import org.apache.inlong.manager.common.enums.ErrorCodeEnum;
import org.apache.inlong.manager.common.enums.GroupStatus;
+import org.apache.inlong.manager.common.exceptions.BusinessException;
import org.apache.inlong.manager.common.exceptions.WorkflowListenerException;
import org.apache.inlong.manager.common.pojo.group.InlongGroupInfo;
-import org.apache.inlong.manager.common.pojo.stream.InlongStreamInfo;
-import
org.apache.inlong.manager.common.pojo.workflow.form.process.LightGroupResourceProcessForm;
+import
org.apache.inlong.manager.common.pojo.workflow.form.process.GroupResourceProcessForm;
import org.apache.inlong.manager.service.group.InlongGroupService;
-import org.apache.inlong.manager.service.core.InlongStreamService;
import org.apache.inlong.manager.workflow.WorkflowContext;
import org.apache.inlong.manager.workflow.event.ListenerResult;
import org.apache.inlong.manager.workflow.event.process.ProcessEvent;
import org.apache.inlong.manager.workflow.event.process.ProcessEventListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-import java.util.List;
-
/**
- * Listener of light group init.
+ * The listener for initial the InlongGroup information.
*/
@Slf4j
@Component
-public class LightGroupInitListener implements ProcessEventListener {
+public class InitGroupListener implements ProcessEventListener {
@Autowired
private InlongGroupService groupService;
- @Autowired
- private InlongStreamService streamService;
-
@Override
public ProcessEvent event() {
return ProcessEvent.CREATE;
}
+ /**
+ * Begin to execute the InlongGroup workflow, init the workflow context,
and update other info if needed.
+ */
@Override
- public ListenerResult listen(WorkflowContext context) throws Exception {
- LightGroupResourceProcessForm form = (LightGroupResourceProcessForm)
context.getProcessForm();
+ public ListenerResult listen(WorkflowContext context) throws
WorkflowListenerException {
+ GroupResourceProcessForm form = (GroupResourceProcessForm)
context.getProcessForm();
+ String groupId = form.getInlongGroupId();
+ log.info("begin to execute InitGroupListener for groupId={}", groupId);
+
InlongGroupInfo groupInfo = form.getGroupInfo();
if (groupInfo == null) {
- throw new
WorkflowListenerException(ErrorCodeEnum.GROUP_NOT_FOUND.getMessage());
+ throw new BusinessException("inlong group info cannot be null for
init group process");
Review Comment:
why here change to `BusinessException` and throws `WorkflowListenerException`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]