org.apache.eventmesh.admin.server.web.HttpServer Maven / Gradle / Ivy
The newest version!
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.eventmesh.admin.server.web;
import org.apache.eventmesh.admin.server.web.db.service.EventMeshTaskInfoService;
import org.apache.eventmesh.admin.server.web.service.monitor.MonitorBizService;
import org.apache.eventmesh.admin.server.web.service.task.TaskBizService;
import org.apache.eventmesh.admin.server.web.service.verify.VerifyBizService;
import org.apache.eventmesh.common.remote.request.CreateTaskRequest;
import org.apache.eventmesh.common.remote.request.QueryTaskInfoRequest;
import org.apache.eventmesh.common.remote.request.QueryTaskMonitorRequest;
import org.apache.eventmesh.common.remote.request.ReportMonitorRequest;
import org.apache.eventmesh.common.remote.request.ReportVerifyRequest;
import org.apache.eventmesh.common.remote.request.TaskBachRequest;
import org.apache.eventmesh.common.remote.request.TaskIDRequest;
import org.apache.eventmesh.common.remote.response.CreateTaskResponse;
import org.apache.eventmesh.common.remote.response.HttpResponseResult;
import org.apache.eventmesh.common.remote.response.QueryTaskInfoResponse;
import org.apache.eventmesh.common.remote.response.QueryTaskMonitorResponse;
import org.apache.eventmesh.common.remote.response.SimpleResponse;
import org.apache.eventmesh.common.utils.JsonUtils;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import lombok.extern.slf4j.Slf4j;
@RestController
@RequestMapping("/eventmesh/admin")
@Slf4j
public class HttpServer {
@Autowired
private TaskBizService taskService;
@Autowired
private VerifyBizService verifyService;
@Autowired
private MonitorBizService monitorService;
@Autowired
private EventMeshTaskInfoService taskInfoService;
@RequestMapping(value = "/createTask", method = RequestMethod.POST)
public String createOrUpdateTask(@RequestBody CreateTaskRequest task) {
log.info("receive http proto create task:{}", task);
CreateTaskResponse createTaskResponse = taskService.createTask(task);
log.info("receive http proto create task result:{}", createTaskResponse);
SimpleResponse simpleResponse = new SimpleResponse();
simpleResponse.setData(createTaskResponse);
return JsonUtils.toJSONString(simpleResponse);
}
@RequestMapping(value = "/reportVerify", method = RequestMethod.POST)
public String reportVerify(@RequestBody ReportVerifyRequest request) {
log.info("receive http proto report verify request:{}", request);
boolean result = verifyService.reportVerifyRecord(request);
log.info("receive http proto report verify result:{}", result);
SimpleResponse simpleResponse = new SimpleResponse();
simpleResponse.setData(result);
return JsonUtils.toJSONString(simpleResponse);
}
@RequestMapping(value = "/reportMonitor", method = RequestMethod.POST)
public String reportMonitor(@RequestBody ReportMonitorRequest request) {
log.info("receive http proto report monitor request:{}", request);
boolean result = monitorService.reportMonitorRecord(request);
log.info("receive http proto report monitor result:{}", result);
SimpleResponse simpleResponse = new SimpleResponse();
simpleResponse.setData(result);
return JsonUtils.toJSONString(simpleResponse);
}
@RequestMapping(value = "/queryTaskMonitor", method = RequestMethod.POST)
public String queryTaskMonitor(@RequestBody QueryTaskMonitorRequest request) {
log.info("receive http proto query task monitor request:{}", request);
QueryTaskMonitorResponse result = monitorService.queryTaskMonitors(request);
log.info("receive http proto query task monitor result:{}", result);
SimpleResponse simpleResponse = new SimpleResponse();
simpleResponse.setData(result);
return JsonUtils.toJSONString(simpleResponse);
}
@RequestMapping(value = "/queryTaskInfo", method = RequestMethod.POST)
public HttpResponseResult
© 2015 - 2025 Weber Informatics LLC | Privacy Policy