diff --git a/frameworks/kafka/src/main/java/com/mesosphere/sdk/kafka/api/TopicResource.java b/frameworks/kafka/src/main/java/com/mesosphere/sdk/kafka/api/TopicResource.java index 7888fe9a..9c85a052 100644 --- a/frameworks/kafka/src/main/java/com/mesosphere/sdk/kafka/api/TopicResource.java +++ b/frameworks/kafka/src/main/java/com/mesosphere/sdk/kafka/api/TopicResource.java @@ -60,7 +60,16 @@ public Response createTopic( try { int partCount = Integer.parseInt(partitionCount); int replFactor = Integer.parseInt(replicationFactor); - return ResponseUtils.jsonOkResponse(cmdExecutor.createTopic(name, partCount, replFactor)); + JSONObject result = cmdExecutor.createTopic(name, partCount, replFactor); + String message = result.getString("message"); + Response.Status status; + if (message.contains("Created topic")) { + status = Response.Status.OK; + } else { + status = Response.Status.INTERNAL_SERVER_ERROR; + log.error("Failed to verify the topic creation: " + name + " with output: " + message); + } + return ResponseUtils.jsonResponse(result, status); } catch (Exception ex) { log.error("Failed to create topic: " + name + " with exception: " + ex); return Response.serverError().build();