import java.util.ArrayList;
import java.util.Collection;
+import org.oran.dmaapadapter.exceptions.ServiceException;
import org.oran.dmaapadapter.r1.ProducerJobInfo;
import org.oran.dmaapadapter.repository.InfoTypes;
import org.oran.dmaapadapter.repository.Job;
public static final String API_NAME = "Producer job control API";
public static final String API_DESCRIPTION = "";
- public static final String JOB_URL = "/dmaap_dataproducer/info_job";
- public static final String SUPERVISION_URL = "/dmaap_dataproducer/health_check";
+ public static final String JOB_URL = "/generic_dataproducer/info_job";
+ public static final String SUPERVISION_URL = "/generic_dataproducer/health_check";
private static Gson gson = new GsonBuilder().create();
private final Jobs jobs;
private final InfoTypes types;
content = @Content(schema = @Schema(implementation = VoidResponse.class))), //
@ApiResponse(responseCode = "404", description = "Information type is not found", //
content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))), //
+ @ApiResponse(responseCode = "400", description = "Other error in the request", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))) //
})
public ResponseEntity<Object> jobCreatedCallback( //
@RequestBody String body) {
this.jobs.addJob(request.id, request.targetUri, types.getType(request.typeId), request.owner,
request.lastUpdated, toJobParameters(request.jobData));
return new ResponseEntity<>(HttpStatus.OK);
+ } catch (ServiceException e) {
+ logger.warn("jobCreatedCallback failed: {}", e.getMessage());
+ return ErrorResponse.create(e, e.getHttpStatus());
} catch (Exception e) {
- return ErrorResponse.create(e, HttpStatus.NOT_FOUND);
+ logger.warn("jobCreatedCallback failed: {}", e.getMessage());
+ return ErrorResponse.create(e, HttpStatus.BAD_REQUEST);
}
}