Exemplo n.º 1
0
 /**
  * Gets a message from RabbitMQ, checks it's a valid transaction and saves it into DB.
  *
  * @param AMQPMessage $rawMessage
  */
 public function process(AMQPMessage $rawMessage)
 {
     $this->logger->debug('Processing message ' . $rawMessage->body);
     try {
         $message = Transaction::extractFromJson($rawMessage->body);
         $message->checkSanity();
         $this->messageDbModel->save($message);
     } catch (Exception $e) {
         // either transaction contains invalid data or there was an error in db
         $this->logger->warn($e->getMessage());
     }
 }
Exemplo n.º 2
0
 /**
  * @expectedException Exception
  * @dataProvider providerWrongTransaction
  * @param string $json
  */
 public function testCheckSanityFails($json)
 {
     $transaction = Transaction::extractFromJson($json);
     $transaction->checkSanity();
 }