Skip to content

Commit 8281276

Browse files
authored
Exception on affected record !=1.
additional exception; avoid using Type::BOOLEAN.
1 parent 516acfa commit 8281276

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pkg/dbal/DbalProducer.php

+6-2
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public function send(Destination $destination, Message $message): void
115115
}
116116

117117
try {
118-
$this->context->getDbalConnection()->insert($this->context->getTableName(), $dbalMessage, [
118+
$rowsAffected = $this->context->getDbalConnection()->insert($this->context->getTableName(), $dbalMessage, [
119119
'id' => Type::GUID,
120120
'published_at' => Type::INTEGER,
121121
'body' => Type::TEXT,
@@ -125,10 +125,14 @@ public function send(Destination $destination, Message $message): void
125125
'queue' => Type::STRING,
126126
'time_to_live' => Type::INTEGER,
127127
'delayed_until' => Type::INTEGER,
128-
'redelivered' => Type::BOOLEAN,
128+
'redelivered' => Type::SMALLINT,
129129
'delivery_id' => Type::STRING,
130130
'redeliver_after' => Type::BIGINT,
131131
]);
132+
133+
if ($rowsAffected !== 1) {
134+
throw new Exception('The message was not enqueued. Dbal did not confirm that record inserted.');
135+
}
132136
} catch (\Exception $e) {
133137
throw new Exception('The transport fails to send the message due to some internal error.', 0, $e);
134138
}

0 commit comments

Comments
 (0)