Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ public class AwsConfig {
@Value("${aws.region}")
private String awsRegion;

@Value("${aws.batch.job.definition}")
private String batchJobDefinition;

@Value("${aws.batch.job.queue}")
private String batchJobQueue;

@Bean
public BatchClient batchClient() {
return BatchClient
Expand All @@ -26,6 +32,6 @@ public BatchClient batchClient() {

@Bean
public RestServices awsBatchService(BatchClient batchClient, ObjectMapper objectMapper) {
return new RestServices(batchClient, objectMapper);
return new RestServices(batchClient, objectMapper, batchJobDefinition, batchJobQueue);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,26 +61,4 @@ public enum Type {
this.value = value;
}
}

@Getter
public enum JobDefinition {
GENERATE_CSV_DATA_FILE("data-access-service-batch-job-definition");

private final String value;

JobDefinition(String value) {
this.value = value;
}
}

@Getter
public enum JobQueue {
GENERATING_CSV_DATA_FILE("data-access-service-batch-job-queue");

private final String value;

JobQueue(String value) {
this.value = value;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,17 @@ public class RestServices {

private final BatchClient batchClient;
private final ObjectMapper objectMapper;
private final String batchJobDefinition;
private final String batchJobQueue;

@Autowired
private DownloadWfsDataService downloadWfsDataService;

public RestServices(BatchClient batchClient, ObjectMapper objectMapper) {
public RestServices(BatchClient batchClient, ObjectMapper objectMapper, String batchJobDefinition, String batchJobQueue) {
this.batchClient = batchClient;
this.objectMapper = objectMapper;
this.batchJobDefinition = batchJobDefinition;
this.batchJobQueue = batchJobQueue;
}

public void notifyUser(String recipient, String uuid, String startDate, String endDate, Object multiPolygon, String collectionTitle,
Expand Down Expand Up @@ -113,10 +117,10 @@ public ResponseEntity<String> downloadData(

String jobId = submitJob(
"generating-data-file-for-" + recipient.replaceAll("[^a-zA-Z0-9-_]", "-"),
DatasetDownloadEnums.JobQueue.GENERATING_CSV_DATA_FILE.getValue(),
DatasetDownloadEnums.JobDefinition.GENERATE_CSV_DATA_FILE.getValue(),
this.batchJobQueue,
this.batchJobDefinition,
parameters);
log.info("Job submitted with ID: " + jobId);
log.info("Job submitted with ID: {}", jobId);
return ResponseEntity.ok("Job submitted with ID: " + jobId);
}

Expand Down
4 changes: 4 additions & 0 deletions server/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ elasticsearch:

aws:
region: ap-southeast-2
batch:
job:
queue: data-access-service-batch-job-queueb
definition: data-access-service-batch-job-definition

wfs-default-param:
fields:
Expand Down
Loading