class LogApiHandler implements Callable<FullHttpResponse> {

	@Override
	public FullHttpResponse call() throws Exception {
		LoggingService.logDebug(MODULE_NAME, "Start handling http call of log api");
		if (!ApiHandlerHelpers.validateMethod(this.req, POST)) {
			LoggingService.logError(MODULE_NAME, "Request method not allowed", new AgentUserException("Request method not allowed"));
			return ApiHandlerHelpers.methodNotAllowedResponse();
		}

		final String contentTypeError = ApiHandlerHelpers.validateContentType(this.req, "application/json");
		if (contentTypeError != null) {
			LoggingService.logError(MODULE_NAME, contentTypeError, new AgentUserException(contentTypeError));
			return ApiHandlerHelpers.badRequestResponse(outputBuffer, contentTypeError);
		}

		String msgString = new String(content, UTF_8);
		JsonReader reader = Json.createReader(new StringReader(msgString));
		JsonObject jsonObject = reader.readObject();

		boolean result = false;
		if (jsonObject.containsKey("message") &&
				jsonObject.containsKey("type") &&
				jsonObject.containsKey("id")){
			String logMessage = jsonObject.getString("message");
			String logType = jsonObject.getString("type");
			String microserviceUuid = jsonObject.getString("id");
			if (logType.equals("info")) {
				result = LoggingService.microserviceLogInfo(microserviceUuid, logMessage);
			} else {
				result = LoggingService.microserviceLogWarning(microserviceUuid, logMessage);
			}
		}
		if (!result) {
			String errorMsg = "Log message parsing error, " + "Logger initialized null";
			LoggingService.logError(MODULE_NAME, errorMsg, new AgentUserException(errorMsg));
			return ApiHandlerHelpers.badRequestResponse(outputBuffer, errorMsg);
		}

		JsonBuilderFactory factory = Json.createBuilderFactory(null);
		JsonObjectBuilder builder = factory.createObjectBuilder();
		builder.add("status", "okay");

		String sendMessageResult = builder.build().toString();

		LoggingService.logDebug(MODULE_NAME, "Finished handling http call of log api");
		return ApiHandlerHelpers.successResponse(outputBuffer, sendMessageResult);
	}

	public  LogApiHandler(HttpRequest request, ByteBuf outputBuffer, byte[] content);

}