/**
* Called for each interaction consumed.
*
* @param DataSift_StreamConsumer $consumer The consumer sending the
* event.
* @param array $interaction The interaction data.
* @param string $hash The hash of the stream that
* matched this interaction.
*
* @return void
*/
public function onInteraction($consumer, $interaction, $hash)
{
echo 'Type: ' . $interaction['interaction']['type'] . "\n";
echo 'Content: ' . $interaction['interaction']['content'] . "\n--\n";
// Stop after 10
if ($this->_num-- == 1) {
echo "Stopping consumer...\n";
$consumer->stop();
}
}