Skip to content

Commit

Permalink
Merge pull request #1 from otzy/otzy-patch-1
Browse files Browse the repository at this point in the history
Exception on affected record !=1.
  • Loading branch information
otzy authored Jan 21, 2019
2 parents 516acfa + 8281276 commit 6bfef63
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/dbal/DbalProducer.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public function send(Destination $destination, Message $message): void
}

try {
$this->context->getDbalConnection()->insert($this->context->getTableName(), $dbalMessage, [
$rowsAffected = $this->context->getDbalConnection()->insert($this->context->getTableName(), $dbalMessage, [
'id' => Type::GUID,
'published_at' => Type::INTEGER,
'body' => Type::TEXT,
Expand All @@ -125,10 +125,14 @@ public function send(Destination $destination, Message $message): void
'queue' => Type::STRING,
'time_to_live' => Type::INTEGER,
'delayed_until' => Type::INTEGER,
'redelivered' => Type::BOOLEAN,
'redelivered' => Type::SMALLINT,
'delivery_id' => Type::STRING,
'redeliver_after' => Type::BIGINT,
]);

if ($rowsAffected !== 1) {
throw new Exception('The message was not enqueued. Dbal did not confirm that record inserted.');
}
} catch (\Exception $e) {
throw new Exception('The transport fails to send the message due to some internal error.', 0, $e);
}
Expand Down

0 comments on commit 6bfef63

Please sign in to comment.