diff --git a/transaction-event-processor/src/main/resources/transaction-event-processor.conf b/transaction-event-processor/src/main/resources/transaction-event-processor.conf index 588ae0db6..cad7eab9c 100644 --- a/transaction-event-processor/src/main/resources/transaction-event-processor.conf +++ b/transaction-event-processor/src/main/resources/transaction-event-processor.conf @@ -21,7 +21,7 @@ schema { channel.default = "org.sunbird" job { - audit-event-generator = true + audit-event-generator = false audit-history-indexer = false - obsrv-metadata-generator = false + obsrv-metadata-generator = true } diff --git a/transaction-event-processor/src/main/scala/org/sunbird/job/transaction/service/TransactionEventProcessorService.scala b/transaction-event-processor/src/main/scala/org/sunbird/job/transaction/service/TransactionEventProcessorService.scala index dc88951f6..917dbd685 100644 --- a/transaction-event-processor/src/main/scala/org/sunbird/job/transaction/service/TransactionEventProcessorService.scala +++ b/transaction-event-processor/src/main/scala/org/sunbird/job/transaction/service/TransactionEventProcessorService.scala @@ -12,13 +12,12 @@ import org.sunbird.job.domain.`object`.{DefinitionCache, ObjectDefinition} import com.google.gson.Gson import org.sunbird.job.exception.InvalidEventException import org.sunbird.job.transaction.task.TransactionEventProcessorConfig -import org.sunbird.telemetry.dto.Telemetry - - +import scala.collection.JavaConverters._ import java.io.IOException import java.util import java.text.SimpleDateFormat import java.util.{Calendar, Date, TimeZone, UUID} +import scala.collection.convert.ImplicitConversions.`map AsScala` trait TransactionEventProcessorService { private[this] lazy val logger = LoggerFactory.getLogger(classOf[TransactionEventProcessorService]) @@ -75,18 +74,16 @@ trait TransactionEventProcessorService { val nvValue = nestedMap.get("nv").collect { case s: String => s } key -> nvValue.getOrElse("") } + logger.info("Updated properties: " + nvValues) - val propertiesWithNvValues = Map("properties" -> propertyMap.map { - case (key, _) => key -> nvValues.getOrElse(key, "") - }) - - if (message.getMap().containsKey("transactionData")) { - message.getMap().replace("transactionData", propertiesWithNvValues) + if(message.getMap().containsKey("transactionData")){ + message.getMap().remove("transactionData") + message.getMap().putAll(nvValues.asJava) } + logger.info("Modified event: " + message) val obsrvEvent = new ObsrvEvent(message.getMap(), message.partition, message.offset) val updatedEvent = obsrvEvent.updateEvent - val outputEvent = JSONUtil.serialize(updatedEvent) context.output(config.obsrvAuditOutputTag, outputEvent)