<commit_before>package com.ubirch.chain.core.actor

import com.ubirch.chain.core.actor.producer.BigchainProducerActor
import com.ubirch.chain.core.actor.util.ActorTools
import com.ubirch.chain.model.rest.Transaction

import akka.actor.{Actor, ActorLogging, Props}

/**
  * author: cvandrei
  * since: 2017-06-23
  */
class BigchainActor extends Actor
  with ActorLogging {

  private implicit val system = context.system
  private val bigchainDbProducer = context.actorOf(BigchainProducerActor.props(), ActorNames.BIGCHAIN_PRODUCER)

  override def receive: Receive = {

    case tx: Transaction =>

      log.debug(s"received tx: $tx")
      if (tx.hash.isDefined) {
        // TODO notify bigchainDbProducer
        //bigchainDbProducer ! tx.hash.get
      } else if (tx.msg.isDefined) {
        // TODO notify bigchainDbProducer
        //bigchainDbProducer ! tx.msg.get
      } else {
        log.error(s"unable to write to BigchainDb if hash and message are empty")
      }

    case _ => log.error("unknown message")

  }

}

object BigchainActor extends ActorTools {
  def props(): Props = roundRobin().props(Props[BigchainActor])
}
<commit_msg>UBI-252: pass Transaction.msg on to BigchainDb<commit_after>package com.ubirch.chain.core.actor

import com.ubirch.chain.core.actor.producer.BigchainProducerActor
import com.ubirch.chain.core.actor.util.ActorTools
import com.ubirch.chain.model.rest.Transaction

import akka.actor.{Actor, ActorLogging, Props}

/**
  * author: cvandrei
  * since: 2017-06-23
  */
class BigchainActor extends Actor
  with ActorLogging {

  private implicit val system = context.system
  private val bigchainDbProducer = context.actorOf(BigchainProducerActor.props(), ActorNames.BIGCHAIN_PRODUCER)

  override def receive: Receive = {

    case tx: Transaction =>

      log.debug(s"received tx: $tx")
      if (tx.hash.isDefined) {
        // TODO notify bigchainDbProducer
        //bigchainDbProducer ! tx.hash.get
      } else if (tx.msg.isDefined) {
        bigchainDbProducer ! tx.msg.get
      } else {
        log.error(s"unable to write to BigchainDb if hash and message are empty")
      }

    case _ => log.error("unknown message")

  }

}

object BigchainActor extends ActorTools {
  def props(): Props = roundRobin().props(Props[BigchainActor])
}

{'fraction_non_alphanumeric': 0.10510248582642825, 'fraction_numerical': 0.008286088094199739, 'mean_word_length': 3.3946360153256707, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3316173', 'n_tokens_mistral': 775, 'n_tokens_neox': 736, 'n_words': 162}