public function haltConsumer($sigNo)
    {
        if ($this->consumer instanceof BaseConsumer) {
            // Process current message, then halt consumer
            $this->consumer->forceStopConsumer();

            // Halt consumer if waiting for a new message from the queue
            try {
                $this->consumer->stopConsuming();
            } catch (AMQPTimeoutException $e) {
                // exit gracefully with a message
                echo("Stopped because: Received stop signal $sigNo\n");
            }

        } elseif ($this->consumer instanceof \Kaliop\QueueingBundle\Queue\SignalHandlingConsumerInterface) {

            $this->consumer->forceStop("Received stop signal $sigNo");

        } else {
            exit();
        }
    }