Skip to content

Commit

Permalink
chore(application): Various fixes in CSV data exporter
Browse files Browse the repository at this point in the history
  • Loading branch information
fussel178 committed Mar 25, 2023
1 parent cdfa37b commit b71e7a9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion application/conf/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
"request-time-sync",
"a-gps-transmitter#request",
"tc-console-request",
"reset-tc-counter"
"reset-tc-counter",
"csv-data-exporter#request"
],
"outboundPermitted": [
"a-gps-transmitter#notify",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,10 @@ public void onStop(Promise<Void> stopPromise) throws Exception {
private MongoClient client;

private void handle(CSVDataRequest request, Message<Object> message) {
logger.debug("Get CSV iridium messages for target: {}", request.target());
getAllIridiumMessages(request.target())
.map(this::createCSVData)
.onSuccess(message::reply)
.onSuccess(data -> message.reply(data.json()))
.onFailure(cause -> message.fail(500, cause.getMessage()));
}

Expand All @@ -92,7 +93,7 @@ private CSVData createCSVData(List<JsonObject> results) {
.map(this::mergeInfos)
.collect(Collectors.joining("\n"));

return new CSVData(0, header + body);
return new CSVData(results.size(), header + body);
}

private Future<List<JsonObject>> getAllIridiumMessages(String target) {
Expand Down

0 comments on commit b71e7a9

Please sign in to comment.