Skip to content

Commit

Permalink
Merge pull request #16 from lengqiuqiuqiu/main
Browse files Browse the repository at this point in the history
判断队列名$queue是否为空
  • Loading branch information
walkor committed Apr 3, 2024
2 parents 60be9a1 + 99993b9 commit 80b9ddc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Process/Consumer.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* This file is part of webman.
*
Expand Down Expand Up @@ -65,6 +66,10 @@ public function onWorkerStart()
$consumer = Container::get($class);
$connection_name = $consumer->connection ?? 'default';
$queue = $consumer->queue;
if (!$queue) {
echo "Consumer {$class} queue not exists\r\n";
continue;
}
$this->_consumers[$queue] = $consumer;
$connection = Client::connection($connection_name);
$connection->subscribe($queue, [$consumer, 'consume']);
Expand All @@ -79,6 +84,5 @@ public function onWorkerStart()
}
}
}

}
}

0 comments on commit 80b9ddc

Please sign in to comment.