How do I stop the livestream consumer


#1

I’m using the PHP library and I can’t see how to stop the consumer from consuming?

Thanks in advance,

Jon


#2

You need to call

$consumer->stop();

You can see an example of this in the display() function in our Football example on Github


#3

Unfortunately, this doesn’t appear to be working for me. Could be due to caching on the server I guess.

In my save() function I have the following code:

if ($this->_options[‘datasift’][‘status’] == ‘DISABLED’) {
$consumer->stop();
exit;
}

However, when I updated the option, it kept consuming. So I deleted the file off the server altogether. It kept consuming. The database kept filling up and I’m assuming this will keep costing my company money while it is still consuming.

In the end, I deleted a column from my database which seems to have caused enough of an error to stop the stream.

Once that stream is running, is there really no way to stop it from the outside? Can I run a different function to get the handle to the consumer and ask it to to stop?

I don’t want to continue testing until I know I can reliably stop the consumer every time I need to, so I would appreciate any thoughts you have Jason. Thanks!

Jon


#4

Thanks for raising this issue Jon,

Our development team is looking into it now.


#5

Hello,

Not using the PhP libary - I am using the C# library and have a similar issue. When I recompile the streamhash, I understand that I have to stop the consumer and start a new DatasiftStream. My concern is that when I call the consumer.stop(), I don’t see in the DatasiftStream.cs code that it is actually stopping the Thread it started. i.e. there is no streamThread.stop or terminate. Am I missing something or will this cause the thread to float around till the app terminates? It just propagates the Status.stopped and so stops consuming, but the thread is not terminated. Thanks.


#6

Umm, sorry about the question. Looks like I wasn’t reading it right and it should self terminate. Thanks.