Search in sources :

Example 1 with QueueOperateListener

use of org.apache.inlong.manager.workflow.event.task.QueueOperateListener in project incubator-inlong by apache.

the class ServiceTaskListenerFactoryTest method testGetQueueOperateListener.

@Test
public void testGetQueueOperateListener() {
    WorkflowContext context = new WorkflowContext();
    GroupResourceProcessForm processForm = new GroupResourceProcessForm();
    InlongGroupInfo groupInfo = new InlongGroupInfo();
    // check pulsar listener
    groupInfo.setMiddlewareType(Constant.MIDDLEWARE_PULSAR);
    processForm.setGroupInfo(groupInfo);
    context.setProcessForm(processForm);
    List<QueueOperateListener> queueOperateListeners = serviceTaskListenerFactory.getQueueOperateListener(context);
    Assert.assertEquals(2, queueOperateListeners.size());
    Assert.assertTrue(queueOperateListeners.get(0) instanceof CreatePulsarResourceTaskListener);
    Assert.assertTrue(queueOperateListeners.get(1) instanceof CreatePulsarGroupTaskListener);
    // check tube listener
    groupInfo.setMiddlewareType(Constant.MIDDLEWARE_TUBE);
    queueOperateListeners = serviceTaskListenerFactory.getQueueOperateListener(context);
    Assert.assertEquals(2, queueOperateListeners.size());
    Assert.assertTrue(queueOperateListeners.get(0) instanceof CreateTubeTopicTaskListener);
    Assert.assertTrue(queueOperateListeners.get(1) instanceof CreateTubeGroupTaskListener);
}
Also used : QueueOperateListener(org.apache.inlong.manager.workflow.event.task.QueueOperateListener) CreateTubeTopicTaskListener(org.apache.inlong.manager.service.thirdparty.mq.CreateTubeTopicTaskListener) WorkflowContext(org.apache.inlong.manager.workflow.WorkflowContext) CreatePulsarGroupTaskListener(org.apache.inlong.manager.service.thirdparty.mq.CreatePulsarGroupTaskListener) InlongGroupInfo(org.apache.inlong.manager.common.pojo.group.InlongGroupInfo) CreateTubeGroupTaskListener(org.apache.inlong.manager.service.thirdparty.mq.CreateTubeGroupTaskListener) GroupResourceProcessForm(org.apache.inlong.manager.common.pojo.workflow.form.GroupResourceProcessForm) CreatePulsarResourceTaskListener(org.apache.inlong.manager.service.thirdparty.mq.CreatePulsarResourceTaskListener) Test(org.junit.Test) ServiceBaseTest(org.apache.inlong.manager.service.ServiceBaseTest)

Example 2 with QueueOperateListener

use of org.apache.inlong.manager.workflow.event.task.QueueOperateListener in project incubator-inlong by apache.

the class ServiceTaskListenerFactory method acceptPlugin.

@Override
public void acceptPlugin(Plugin plugin) {
    if (!(plugin instanceof ProcessPlugin)) {
        return;
    }
    ProcessPlugin processPlugin = (ProcessPlugin) plugin;
    Map<DataSourceOperateListener, EventSelector> pluginDsOperateListeners = processPlugin.createSourceOperateListeners();
    if (MapUtils.isNotEmpty(pluginDsOperateListeners)) {
        sourceOperateListeners.putAll(processPlugin.createSourceOperateListeners());
    }
    Map<SinkOperateListener, EventSelector> pluginSinkOperateListeners = processPlugin.createSinkOperateListeners();
    if (MapUtils.isNotEmpty(pluginSinkOperateListeners)) {
        sinkOperateListeners.putAll(pluginSinkOperateListeners);
    }
    Map<QueueOperateListener, EventSelector> pluginQueueOperateListeners = processPlugin.createQueueOperateListeners();
    if (MapUtils.isNotEmpty(pluginQueueOperateListeners)) {
        queueOperateListeners.putAll(pluginQueueOperateListeners);
    }
    Map<SortOperateListener, EventSelector> pluginSortOperateListeners = processPlugin.createSortOperateListeners();
    if (MapUtils.isNotEmpty(pluginSortOperateListeners)) {
        sortOperateListeners.putAll(pluginSortOperateListeners);
    }
}
Also used : QueueOperateListener(org.apache.inlong.manager.workflow.event.task.QueueOperateListener) CreateHiveTableEventSelector(org.apache.inlong.manager.service.thirdparty.hive.CreateHiveTableEventSelector) SourceDeleteEventSelector(org.apache.inlong.manager.service.source.listener.SourceDeleteEventSelector) PulsarEventSelector(org.apache.inlong.manager.service.thirdparty.mq.PulsarEventSelector) TubeEventSelector(org.apache.inlong.manager.service.thirdparty.mq.TubeEventSelector) ZkDisabledEventSelector(org.apache.inlong.manager.service.thirdparty.sort.ZkDisabledEventSelector) SourceRestartEventSelector(org.apache.inlong.manager.service.source.listener.SourceRestartEventSelector) SourceStopEventSelector(org.apache.inlong.manager.service.source.listener.SourceStopEventSelector) ZkEnabledEventSelector(org.apache.inlong.manager.service.thirdparty.sort.ZkEnabledEventSelector) EventSelector(org.apache.inlong.manager.workflow.event.EventSelector) SortOperateListener(org.apache.inlong.manager.workflow.event.task.SortOperateListener) DataSourceOperateListener(org.apache.inlong.manager.workflow.event.task.DataSourceOperateListener) SinkOperateListener(org.apache.inlong.manager.workflow.event.task.SinkOperateListener) ProcessPlugin(org.apache.inlong.manager.workflow.plugin.ProcessPlugin)

Aggregations

QueueOperateListener (org.apache.inlong.manager.workflow.event.task.QueueOperateListener)2 InlongGroupInfo (org.apache.inlong.manager.common.pojo.group.InlongGroupInfo)1 GroupResourceProcessForm (org.apache.inlong.manager.common.pojo.workflow.form.GroupResourceProcessForm)1 ServiceBaseTest (org.apache.inlong.manager.service.ServiceBaseTest)1 SourceDeleteEventSelector (org.apache.inlong.manager.service.source.listener.SourceDeleteEventSelector)1 SourceRestartEventSelector (org.apache.inlong.manager.service.source.listener.SourceRestartEventSelector)1 SourceStopEventSelector (org.apache.inlong.manager.service.source.listener.SourceStopEventSelector)1 CreateHiveTableEventSelector (org.apache.inlong.manager.service.thirdparty.hive.CreateHiveTableEventSelector)1 CreatePulsarGroupTaskListener (org.apache.inlong.manager.service.thirdparty.mq.CreatePulsarGroupTaskListener)1 CreatePulsarResourceTaskListener (org.apache.inlong.manager.service.thirdparty.mq.CreatePulsarResourceTaskListener)1 CreateTubeGroupTaskListener (org.apache.inlong.manager.service.thirdparty.mq.CreateTubeGroupTaskListener)1 CreateTubeTopicTaskListener (org.apache.inlong.manager.service.thirdparty.mq.CreateTubeTopicTaskListener)1 PulsarEventSelector (org.apache.inlong.manager.service.thirdparty.mq.PulsarEventSelector)1 TubeEventSelector (org.apache.inlong.manager.service.thirdparty.mq.TubeEventSelector)1 ZkDisabledEventSelector (org.apache.inlong.manager.service.thirdparty.sort.ZkDisabledEventSelector)1 ZkEnabledEventSelector (org.apache.inlong.manager.service.thirdparty.sort.ZkEnabledEventSelector)1 WorkflowContext (org.apache.inlong.manager.workflow.WorkflowContext)1 EventSelector (org.apache.inlong.manager.workflow.event.EventSelector)1 DataSourceOperateListener (org.apache.inlong.manager.workflow.event.task.DataSourceOperateListener)1 SinkOperateListener (org.apache.inlong.manager.workflow.event.task.SinkOperateListener)1