Skip to content

Commit 56db81f

Browse files
committed
Add SwooleConfig and Fix shortcut name
1 parent 4ac3533 commit 56db81f

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/Handler/AbstractHandler.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ public function getConnectConfig(): ClientConfig
148148
->setProtocolName($this->getProtocolName())
149149
->setProtocolLevel($this->getProtocolLevel())
150150
->setSockType($this->getSocketType())
151+
->setSwooleConfig($this->getSwooleConfig())
151152
->setMaxAttempts(0); // Disable auto reconnection
152153
}
153154

@@ -171,6 +172,18 @@ public function genWillData(): array
171172
return [];
172173
}
173174

175+
public function getSwooleConfig(): array
176+
{
177+
$path = $this->input->getOption('config-path');
178+
if ($path && is_file($path)) {
179+
$content = include $path;
180+
181+
return $content;
182+
}
183+
184+
return [];
185+
}
186+
174187
protected function log($msg): void
175188
{
176189
$date = date('Y-m-d H:i:s');

src/Handler/PublishHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function handle(InputInterface $input, OutputInterface $output): int
4343
}
4444
$publish = $client->publish($topic, $message, $this->getQos(), $this->getDup(), $this->getRetain());
4545
} catch (\Throwable $e) {
46-
$this->logError("Publish error: {$e->getMessage()}");
46+
$this->logError('Publish error');
4747
goto failure;
4848
}
4949

0 commit comments

Comments
 (0)