Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix- data_producer_id missing in reports and dlq #174

Merged
merged 2 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -56,6 +56,7 @@ class ReportManager: KoinComponent {
* @param content Any?
* @param jurisdiction String?
* @param senderId String?
* @param dataProducerId String?
* @param dispositionType DispositionType
* @param source Source
* @return String
Expand All @@ -76,6 +77,7 @@ class ReportManager: KoinComponent {
content: Any?,
jurisdiction: String?,
senderId:String?,
dataProducerId: String?,
dispositionType: DispositionType,
source: Source
): String {
Expand All @@ -93,6 +95,7 @@ class ReportManager: KoinComponent {
content,
jurisdiction,
senderId,
dataProducerId,
dispositionType,
source
)
Expand All @@ -116,6 +119,7 @@ class ReportManager: KoinComponent {
* @param content Any?
* @param jurisdiction String?
* @param senderId String?
* @param dataProducerId String?
* @param dispositionType DispositionType - indicates whether to add or replace any existing reports for the given stageName.
* @param source Source
* @return String - report identifier
Expand All @@ -132,6 +136,7 @@ class ReportManager: KoinComponent {
content: Any?,
jurisdiction: String?,
senderId:String?,
dataProducerId: String?,
dispositionType: DispositionType,
source: Source): String {

Expand Down Expand Up @@ -173,6 +178,7 @@ class ReportManager: KoinComponent {
content,
jurisdiction,
senderId,
dataProducerId,
source
)
}
Expand All @@ -191,6 +197,7 @@ class ReportManager: KoinComponent {
content,
jurisdiction,
senderId,
dataProducerId,
source
)
}
Expand All @@ -212,6 +219,7 @@ class ReportManager: KoinComponent {
* @param content Any?
* @param jurisdiction String?
* @param senderId String?
* @param dataProducerId String?
* @param source Source
* @return String
* @throws BadStateException
Expand All @@ -229,6 +237,7 @@ class ReportManager: KoinComponent {
content: Any?,
jurisdiction: String?,
senderId:String?,
dataProducerId: String?,
source: Source): String {
val stageReportId = UUID.randomUUID().toString()
val stageReport = Report().apply {
Expand All @@ -238,14 +247,13 @@ class ReportManager: KoinComponent {
this.dataStreamId = dataStreamId
this.dataStreamRoute = dataStreamRoute
this.dexIngestDateTime = dexIngestDateTime
this.jurisdiction = jurisdiction
this.senderId = senderId
this.messageMetadata = messageMetadata
this.stageInfo= stageInfo
this.tags = tags
this.data = data
this.jurisdiction = jurisdiction
this.senderId = senderId
this.dataProducerId= dataProducerId
this.contentType = contentType

if (contentType.lowercase() == "json") {
Expand All @@ -272,6 +280,7 @@ class ReportManager: KoinComponent {
* @param content String
* @param jurisdiction String?
* @param senderId String?
* @param dataProducerId String?
* @return String
* @throws BadStateException
*/
Expand All @@ -290,6 +299,7 @@ class ReportManager: KoinComponent {
content: Any?,
jurisdiction: String?,
senderId:String?,
dataProducerId: String?,
deadLetterReasons: List<String>,
validationSchemaFileNames:List<String>
): String {
Expand All @@ -302,14 +312,13 @@ class ReportManager: KoinComponent {
this.dataStreamId = dataStreamId
this.dataStreamRoute = dataStreamRoute
this.dexIngestDateTime = dexIngestDateTime
this.jurisdiction= jurisdiction
this.senderId= senderId
this.messageMetadata= messageMetadata
this.stageInfo= stageInfo
this.tags= tags
this.data= data
this.jurisdiction= jurisdiction
this.senderId= senderId
this.dataProducerId= dataProducerId
this.dispositionType= dispositionType.toString()
this.contentType = contentType
this.deadLetterReasons= deadLetterReasons
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import java.util.*
* @property contentType String?
* @property jurisdiction String?
* @property senderId String?
* @param dataProducerId String?
* @property content Any?
* @property timestamp Date
* @constructor
Expand Down Expand Up @@ -66,6 +67,9 @@ open class Report(
@SerializedName("sender_id")
var senderId: String? = null,

@SerializedName("data_producer_id")
var dataProducerId: String? = null,

var content: Any? = null,

val timestamp: Date = Date()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ class CreateReportSBMessage: ServiceBusMessage() {
@SerializedName("sender_id")
var senderId: String? = null

@SerializedName("data_producer_id")
var dataProducerId: String? = null

@SerializedName("content_type")
var contentType: String? = null

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ class ServiceBusProcessor {
createReportMessage.content!!, // it was Content I changed to ContentAsString
createReportMessage.jurisdiction,
createReportMessage.senderId,
createReportMessage.dataProducerId,
createReportMessage.dispositionType,
Source.SERVICEBUS
)
Expand Down Expand Up @@ -286,7 +287,7 @@ class ServiceBusProcessor {

jurisdiction = runCatching { jsonNode.get("jurisdiction") }.getOrNull()?.asText()
senderId = runCatching { jsonNode.get("sender_id") }.getOrNull()?.asText()

dataProducerId = runCatching { jsonNode.get("data_producer_id") }.getOrNull()?.asText()
contentType = runCatching { jsonNode.get("content_type") }.getOrNull()?.asText()
// Try to get the content as JSON object, but if not, get it as a string
val contentAsNode = runCatching { jsonNode.get("content") }.getOrNull()
Expand Down Expand Up @@ -327,6 +328,7 @@ class ServiceBusProcessor {
createReportMessage.content,
createReportMessage.jurisdiction,
createReportMessage.senderId,
createReportMessage.dataProducerId,
invalidData,
validationSchemaFileNames
)
Expand Down
Loading