Search in sources :

Example 1 with SinkForSortDTO

use of org.apache.inlong.manager.common.pojo.sink.SinkForSortDTO in project incubator-inlong by apache.

the class CreateHiveTableListener method listen.

@Override
public ListenerResult listen(WorkflowContext context) {
    GroupResourceProcessForm form = (GroupResourceProcessForm) context.getProcessForm();
    String groupId = form.getInlongGroupId();
    log.info("begin to create hive table for groupId={}", groupId);
    List<SinkForSortDTO> configList = sinkMapper.selectAllConfig(groupId, null);
    List<SinkForSortDTO> needCreateList = configList.stream().filter(sinkForSortDTO -> sinkForSortDTO.getEnableCreateResource() == 1).collect(Collectors.toList());
    if (hiveTableOperator == null) {
        hiveTableOperator = (IHiveTableOperator) SpringContextUtils.getBean(IHiveTableOperator.BEAN_NAME, DefaultHiveTableOperator.class.getName());
    }
    hiveTableOperator.createHiveResource(groupId, needCreateList);
    String result = "success to create hive table for group [" + groupId + "]";
    log.info(result);
    return ListenerResult.success(result);
}
Also used : StreamSinkEntityMapper(org.apache.inlong.manager.dao.mapper.StreamSinkEntityMapper) SinkForSortDTO(org.apache.inlong.manager.common.pojo.sink.SinkForSortDTO) Autowired(org.springframework.beans.factory.annotation.Autowired) Collectors(java.util.stream.Collectors) SpringContextUtils(org.apache.inlong.manager.service.utils.SpringContextUtils) GroupResourceProcessForm(org.apache.inlong.manager.common.pojo.workflow.form.GroupResourceProcessForm) List(java.util.List) ListenerResult(org.apache.inlong.manager.workflow.event.ListenerResult) Slf4j(lombok.extern.slf4j.Slf4j) SinkOperateListener(org.apache.inlong.manager.workflow.event.task.SinkOperateListener) TaskEvent(org.apache.inlong.manager.workflow.event.task.TaskEvent) Service(org.springframework.stereotype.Service) WorkflowContext(org.apache.inlong.manager.workflow.WorkflowContext) GroupResourceProcessForm(org.apache.inlong.manager.common.pojo.workflow.form.GroupResourceProcessForm) SinkForSortDTO(org.apache.inlong.manager.common.pojo.sink.SinkForSortDTO)

Example 2 with SinkForSortDTO

use of org.apache.inlong.manager.common.pojo.sink.SinkForSortDTO in project incubator-inlong by apache.

the class CreateHiveTableForStreamListener method listen.

@Override
public ListenerResult listen(WorkflowContext context) {
    GroupResourceProcessForm form = (GroupResourceProcessForm) context.getProcessForm();
    String groupId = form.getInlongGroupId();
    String streamId = form.getInlongStreamId();
    log.info("begin create hive table for groupId={}, streamId={}", groupId, streamId);
    List<SinkForSortDTO> configList = sinkMapper.selectAllConfig(groupId, streamId);
    if (hiveTableOperator == null) {
        hiveTableOperator = (IHiveTableOperator) SpringContextUtils.getBean(IHiveTableOperator.BEAN_NAME, DefaultHiveTableOperator.class.getName());
    }
    hiveTableOperator.createHiveResource(groupId, configList);
    String result = "success to create hive table for group [" + groupId + "], stream [" + streamId + "]";
    log.info(result);
    return ListenerResult.success(result);
}
Also used : GroupResourceProcessForm(org.apache.inlong.manager.common.pojo.workflow.form.GroupResourceProcessForm) SinkForSortDTO(org.apache.inlong.manager.common.pojo.sink.SinkForSortDTO)

Aggregations

SinkForSortDTO (org.apache.inlong.manager.common.pojo.sink.SinkForSortDTO)2 GroupResourceProcessForm (org.apache.inlong.manager.common.pojo.workflow.form.GroupResourceProcessForm)2 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 Slf4j (lombok.extern.slf4j.Slf4j)1 StreamSinkEntityMapper (org.apache.inlong.manager.dao.mapper.StreamSinkEntityMapper)1 SpringContextUtils (org.apache.inlong.manager.service.utils.SpringContextUtils)1 WorkflowContext (org.apache.inlong.manager.workflow.WorkflowContext)1 ListenerResult (org.apache.inlong.manager.workflow.event.ListenerResult)1 SinkOperateListener (org.apache.inlong.manager.workflow.event.task.SinkOperateListener)1 TaskEvent (org.apache.inlong.manager.workflow.event.task.TaskEvent)1 Autowired (org.springframework.beans.factory.annotation.Autowired)1 Service (org.springframework.stereotype.Service)1