Skip to content

Commit

Permalink
docs: simplify comments and remove redundant JavaDoc.
Browse files Browse the repository at this point in the history
Removed verbose and redundant JavaDoc comments, replacing them with concise inline comments to improve code readability. This change ensures that key processing logic remains documented without unnecessary detail duplication.
  • Loading branch information
mcook42 committed Dec 26, 2024
1 parent 6d60ed2 commit 0bc948a
Showing 1 changed file with 4 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,6 @@ public Asn1EncodedDataRouter(Asn1CoderTopics asn1CoderTopics,
/**
* Listens for messages from the specified Kafka topic and processes them.
*
* <p>Cases:
* - CASE 1: no SDW in metadata (SNMP deposit only) - sign MF - send to RSU - CASE 2: SDW in
* metadata but no ASD in body (send back for another encoding) - sign MF - send to RSU - craft
* ASD object - publish back to encoder stream - CASE 3: If SDW in metadata and ASD in body
* (double encoding complete) - send to SDX
*
* </p>
*
* @param consumerRecord The Kafka consumer record containing the key and value of the consumed
* message.
*/
Expand Down Expand Up @@ -171,14 +163,6 @@ public void listen(ConsumerRecord<String, String> consumerRecord)
}
}


/**
* Gets the service request based on the consumed JSONObject.
*
* @param metadataJson The metadata JSON object to retrieve the service request for
*
* @return The service request
*/
private ServiceRequest getServiceRequest(JSONObject metadataJson) throws JsonProcessingException {
String serviceRequestJson = metadataJson.getJSONObject(TimTransmogrifier.REQUEST_STRING).toString();
log.debug("ServiceRequest: {}", serviceRequestJson);
Expand All @@ -196,6 +180,7 @@ private void processSignedMessage(ServiceRequest request, JSONObject dataObj) {
kafkaTemplate.send(this.sdxDepositTopic, deposit.toString());
}

// no SDW in metadata (SNMP deposit only) -> sign MF -> send to RSU
private void processUnsignedMessage(ServiceRequest request,
JSONObject metadataJson,
JSONObject payloadJson) {
Expand All @@ -217,6 +202,8 @@ private void processUnsignedMessage(ServiceRequest request,
publishForSecondEncoding(request, encodedTimWithoutHeaders);
}

// SDW in metadata but no ASD in body (send back for another encoding) -> sign MessageFrame
// -> send to RSU -> craft ASD object -> publish back to encoder stream
private void processEncodedTimUnsigned(ServiceRequest request, JSONObject metadataJson, JSONObject payloadJson) {
log.debug("Unsigned ASD received. Depositing it to SDW.");

Expand Down Expand Up @@ -245,6 +232,7 @@ private void processEncodedTimUnsigned(ServiceRequest request, JSONObject metada
}
}

// If SDW in metadata and ASD in body (double encoding complete) -> send to SDX
private void depositToSdx(ServiceRequest request, String asdBytes) {
try {
JSONObject deposit = new JSONObject();
Expand Down

0 comments on commit 0bc948a

Please sign in to comment.