Skip to content

Commit

Permalink
Add Filtered TMC Topic deposit to Asn1EncodedDataRouter
Browse files Browse the repository at this point in the history
  • Loading branch information
mwodahl committed Oct 11, 2024
1 parent aa57462 commit 227d73b
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
Expand Down Expand Up @@ -124,6 +125,17 @@ public Object process(String consumedData) {
}
}

// if the TIM was generated by the TMC upload the record to the filtered TMC TIM topic
try {
String generatedBy = consumedObj.getJSONObject("metadata").getString("recordGeneratedBy");
if (generatedBy.equalsIgnoreCase("TMC")) {
String obfuscatedDataString = consumedObj.toString().replaceAll("\"rsuPassword\": *\".*?\"", "\"rsuPassword\":\"*\"");
stringMsgProducer.send(odeProperties.getKafkaTopicOdeTimJsonTMCFiltered(), null, obfuscatedDataString);
}
} catch (Exception e) {
logger.error("Error while checking recordGeneratedBy field: {}", e.getMessage());
}

// Convert JSON to POJO
ServiceRequest servicerequest = getServicerequest(consumedObj);

Expand Down

0 comments on commit 227d73b

Please sign in to comment.