Skip to content

Commit

Permalink
[ISSUE apache#5073] Fix eventmesh-admin-server createTask response error
Browse files Browse the repository at this point in the history
  • Loading branch information
xwm1992 committed Aug 8, 2024
1 parent 691aab0 commit d8ff0e2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import org.apache.eventmesh.admin.server.web.service.task.TaskBizService;
import org.apache.eventmesh.common.remote.request.CreateTaskRequest;
import org.apache.eventmesh.common.utils.JsonUtils;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
Expand All @@ -27,18 +28,17 @@
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.druid.support.json.JSONUtils;

@RestController
@RequestMapping("/eventmesh/admin")
public class HttpServer {

@Autowired
private TaskBizService taskService;

@RequestMapping(value = "/createTask", method = RequestMethod.POST)
public ResponseEntity<Object> createOrUpdateTask(@RequestBody CreateTaskRequest task) {
String uuid = taskService.createTask(task);
return ResponseEntity.ok(JSONUtils.toJSONString(Response.success(uuid)));
return ResponseEntity.ok(JsonUtils.toJSONString(Response.success(uuid)));
}

public boolean deleteTask(Long id) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,15 @@

import org.apache.eventmesh.common.remote.exception.ErrorCode;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class Response<T> {

private int code;

private boolean success;

private String desc;
Expand Down

0 comments on commit d8ff0e2

Please sign in to comment.