How do you stop a Kafka consumer from the front-end using Laravel API
Hello, I hope that you're having a great day.
I'm using kafka to receive data from IIoT, everything work fine I create a KafkaConsumerService and an artisan console command to consume data and displaying it in real-time. But if I want to stop the consumer (because there is a loop that consume data repeadatlly) I need to kill the process (ctrl+c).
But I want to stop the monitoring in the dashboard from the front end by clicking a button then I will remove the user from the channel and stoping the consumer, but just how do I do that? I thought hard about this problem? If I send a Rest API request to the controller then it will get stuck in the loop and I have no way to stop the consumer.
I thought about using the artisan command because you could run an artisan command programmatically and I know that you could send a SIGINT or SIGTERM signals to terminate the process but is there a way to add a unique key to the session of a user then I will use this unique key to kill the matched process!?
I read the Laravel artisan console documentation but I didn't found about a process having a unique key.
NOTE: I'm also using Redis
Thanks for your help
Please or to participate in this conversation.