Skip to content

Commit 980d7e8

Browse files
committed
feat(consumer): add a way to stop consumer
1 parent 9c2f544 commit 980d7e8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/Clients/Consumer/KafkaConsumer.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,11 @@ public function shutdown(): void
146146
{
147147
$this->logger->debug('Shutting down');
148148

149+
$this->stop();
150+
}
151+
152+
public function stop(): void
153+
{
149154
$this->shouldRun = false;
150155
}
151156

@@ -160,6 +165,7 @@ private function doStart(
160165
callable|null $onPartitionEof = null,
161166
callable|null $onTimedOut = null,
162167
): void {
168+
$this->shouldRun = true;
163169
$this->registerSignals($this->shouldRun);
164170

165171
while ($this->shouldRun) {

0 commit comments

Comments
 (0)