Skip to content

Commit

Permalink
Merge pull request #73 from shikshalokam/kafkalogs_4.7
Browse files Browse the repository at this point in the history
kafka logs changes
  • Loading branch information
aks30 authored Feb 8, 2022
2 parents bfe1d6b + b1f8063 commit 4b5ac20
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 15 deletions.
4 changes: 2 additions & 2 deletions config/kafkaConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ var connect = function() {

consumer.on('message', async function (message) {

console.log("-------Kafka log starts here------------------");
console.log("-------Kafka consumer log starts here------------------");
console.log("Topic Name: ", process.env.SUBMISSION_RATING_QUEUE_TOPIC);
console.log("Message: ", JSON.stringify(message));
console.log("-------Kafka log ends here------------------");
console.log("-------Kafka consumer log ends here------------------");

submissionRatingQueueConsumer.messageReceived(message)
});
Expand Down
3 changes: 2 additions & 1 deletion generics/helpers/emailCommunications.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const emailCommunicationsOnOff = (!process.env.EMAIL_COMMUNICATIONS_ON_OFF || process.env.EMAIL_COMMUNICATIONS_ON_OFF != "OFF") ? "ON" : "OFF"
// const emailCommunicationsOnOff = (!process.env.EMAIL_COMMUNICATIONS_ON_OFF || process.env.EMAIL_COMMUNICATIONS_ON_OFF != "OFF") ? "ON" : "OFF"
const emailCommunicationsOnOff = "OFF";
const emailServiceBaseUrl = (process.env.EMAIL_SERVICE_BASE_URL && process.env.EMAIL_SERVICE_BASE_URL != "") ? process.env.EMAIL_SERVICE_BASE_URL : ""
const emailServiceToken = (process.env.EMAIL_SERVICE_TOKEN && process.env.EMAIL_SERVICE_TOKEN != "") ? process.env.EMAIL_SERVICE_TOKEN : ""
const Request = require(GENERIC_HELPERS_PATH+'/httpRequest');
Expand Down
4 changes: 2 additions & 2 deletions generics/helpers/kafkaCommunications.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,10 @@ const pushMessageToKafka = function(payload) {
throw reject("Kafka configuration is not done")
}

console.log("-------Kafka log starts here------------------");
console.log("-------Kafka producer log starts here------------------");
console.log("Topic Name: ", payload[0].topic);
console.log("Message: ", JSON.stringify(payload));
console.log("-------Kafka log ends here------------------");
console.log("-------Kafka producer log ends here------------------");


kafkaClient.kafkaProducer.send(payload, (err, data) => {
Expand Down
10 changes: 5 additions & 5 deletions module/observationSubmissions/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -333,16 +333,16 @@ module.exports = class ObservationSubmissionsHelper {
}
);
await this.pushObservationSubmissionForReporting(submissionId);
emailClient.pushMailToEmailService(emailRecipients,messageConstants.apiResponses.OBSERVATION_AUTO_RATING_SUCCESS+" - "+submissionId,JSON.stringify(resultingArray));
// emailClient.pushMailToEmailService(emailRecipients,messageConstants.apiResponses.OBSERVATION_AUTO_RATING_SUCCESS+" - "+submissionId,JSON.stringify(resultingArray));
return resolve(messageConstants.apiResponses.OBSERVATION_RATING);
} else {
emailClient.pushMailToEmailService(emailRecipients,messageConstants.apiResponses.OBSERVATION_AUTO_RATING_FAILED+" - "+submissionId,JSON.stringify(resultingArray));
// emailClient.pushMailToEmailService(emailRecipients,messageConstants.apiResponses.OBSERVATION_AUTO_RATING_FAILED+" - "+submissionId,JSON.stringify(resultingArray));
return resolve(messageConstants.apiResponses.OBSERVATION_RATING);
}

} catch (error) {

emailClient.pushMailToEmailService(emailRecipients,messageConstants.apiResponses.OBSERVATION_AUTO_RATING_FAILED+" - "+submissionId,error.message);
// emailClient.pushMailToEmailService(emailRecipients,messageConstants.apiResponses.OBSERVATION_AUTO_RATING_FAILED+" - "+submissionId,error.message);
return reject(error);
}
})
Expand Down Expand Up @@ -390,11 +390,11 @@ module.exports = class ObservationSubmissionsHelper {

await this.pushObservationSubmissionForReporting(submissionId);

emailClient.pushMailToEmailService(emailRecipients,"Successfully marked submission " + submissionId + "complete and pushed for reporting","NO TEXT AVAILABLE");
// emailClient.pushMailToEmailService(emailRecipients,"Successfully marked submission " + submissionId + "complete and pushed for reporting","NO TEXT AVAILABLE");
return resolve(messageConstants.apiResponses.OBSERVATION_RATING);

} catch (error) {
emailClient.pushMailToEmailService(emailRecipients,messageConstants.apiResponses.OBSERVATION_AUTO_RATING_FAILED+" - "+submissionId,error.message);
// emailClient.pushMailToEmailService(emailRecipients,messageConstants.apiResponses.OBSERVATION_AUTO_RATING_FAILED+" - "+submissionId,error.message);
return reject(error);
}
})
Expand Down
10 changes: 5 additions & 5 deletions module/submissions/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -879,15 +879,15 @@ module.exports = class SubmissionsHelper {
}
);
await this.pushCompletedSubmissionForReporting(submissionId);
emailClient.pushMailToEmailService(emailRecipients,messageConstants.apiResponses.SUBMISSION_AUTO_RATING_SUCCESS+" - "+submissionId,JSON.stringify(resultingArray));
// emailClient.pushMailToEmailService(emailRecipients,messageConstants.apiResponses.SUBMISSION_AUTO_RATING_SUCCESS+" - "+submissionId,JSON.stringify(resultingArray));
return resolve(messageConstants.apiResponses.SUBMISSION_RATING_COMPLETED);
} else {
emailClient.pushMailToEmailService(emailRecipients,messageConstants.apiResponses.SUBMISSION_AUTO_RATING_FAILED+" - "+submissionId,JSON.stringify(resultingArray));
// emailClient.pushMailToEmailService(emailRecipients,messageConstants.apiResponses.SUBMISSION_AUTO_RATING_FAILED+" - "+submissionId,JSON.stringify(resultingArray));
return resolve(messageConstants.apiResponses.SUBMISSION_RATING_COMPLETED);
}

} catch (error) {
emailClient.pushMailToEmailService(emailRecipients,messageConstants.apiResponses.SUBMISSION_AUTO_RATING_FAILED+" - "+submissionId,error.message);
// emailClient.pushMailToEmailService(emailRecipients,messageConstants.apiResponses.SUBMISSION_AUTO_RATING_FAILED+" - "+submissionId,error.message);
return reject(error);
}
})
Expand Down Expand Up @@ -936,12 +936,12 @@ module.exports = class SubmissionsHelper {

await this.pushCompletedSubmissionForReporting(submissionId);

emailClient.pushMailToEmailService(emailRecipients,"Successfully marked submission " + submissionId + "complete and pushed for reporting","NO TEXT AVAILABLE");
// emailClient.pushMailToEmailService(emailRecipients,"Successfully marked submission " + submissionId + "complete and pushed for reporting","NO TEXT AVAILABLE");
return resolve(messageConstants.apiResponses.SUBMISSION_RATING_COMPLETED);


} catch (error) {
emailClient.pushMailToEmailService(emailRecipients,messageConstants.apiResponses.SUBMISSION_AUTO_RATING_FAILED+" - "+submissionId,error.message);
// emailClient.pushMailToEmailService(emailRecipients,messageConstants.apiResponses.SUBMISSION_AUTO_RATING_FAILED+" - "+submissionId,error.message);
return reject(error);
}
})
Expand Down

0 comments on commit 4b5ac20

Please sign in to comment.