Skip to content

Commit 767fb4c

Browse files
committed
add send AMQPException
1 parent a83ede2 commit 767fb4c

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/Protocols/Amqp.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,21 @@ public function disconnect(): void
8282
* @throws \AMQPChannelException
8383
* @throws \AMQPConnectionException
8484
* @throws \AMQPExchangeException
85+
* @throws \AMQPException
8586
*/
8687
public function send(string $destination, string $message, array $settings = []): bool
8788
{
8889
$this->checkConnection();
8990

9091
$exchange = new AMQPExchange($this->channel);
91-
$exchange->setName($destination);
9292

93-
return $exchange->publish($message, null, AMQP_NOPARAM, $settings);
93+
$result = $exchange->publish($message, $destination, AMQP_NOPARAM, $settings);
94+
95+
if (!$result) {
96+
throw new \AMQPException('Failed to publish content.');
97+
}
98+
99+
return $result;
94100
}
95101

96102
/**

0 commit comments

Comments
 (0)