public function consumeOne(MessageInterface $message)
    {
        $consumeEvent = new ConsumeEvent($message);

        try {
            $this->dispatcher->dispatch(BarbeQEvents::PRE_CONSUME, $consumeEvent);

            $message->start();

            $this->messageDispatcher->dispatch($message->getQueue(), $consumeEvent);

            $message->complete();
            $this->adapter->onSuccess($message);

            $this->dispatcher->dispatch(BarbeQEvents::POST_CONSUME, $consumeEvent);
        } catch(\Exception $e) {
            $message->completeWithError();
            $this->adapter->onError($message);

            $this->dispatcher->dispatch(BarbeQEvents::POST_CONSUME, $consumeEvent);

            // TODO
            throw new ConsumerIndigestionException("Error while consuming a message", 0, $e);
        }
    }
public function consumeOne(MessageInterface $message)
    {
        $consumeEvent = new ConsumeEvent($message);

        try {
            $this->dispatcher->dispatch(BarbeQEvents::PRE_CONSUME, $consumeEvent);

            $message->start();

            $this->messageDispatcher->dispatch($message->getQueue(), $consumeEvent);

            $message->complete();
            $this->adapter->onSuccess($message);

            $this->dispatcher->dispatch(BarbeQEvents::POST_CONSUME, $consumeEvent);
        } catch(\Exception $e) {
            $message->completeWithError();
            $this->adapter->onError($message);

            $this->dispatcher->dispatch(BarbeQEvents::POST_CONSUME, $consumeEvent);

            // TODO
            throw new ConsumerIndigestionException("Error while consuming a message", 0, $e);
        }
    }
public function consumeOne ( MessageInterface $ message ) { $ consumeEvent = new ConsumeEvent ( $ message ) ; try { $ this -> dispatcher -> dispatch ( BarbeQEvents :: PRE_CONSUME , $ consumeEvent ) ; $ message -> start ( ) ; $ this -> messageDispatcher -> dispatch ( $ message -> getQueue ( ) , $ consumeEvent ) ; $ message -> complete ( ) ; $ this -> adapter -> onSuccess ( $ message ) ; $ this -> dispatcher -> dispatch ( BarbeQEvents :: POST_CONSUME , $ consumeEvent ) ; } catch ( \ Exception $ e ) { $ message -> completeWithError ( ) ; $ this -> adapter -> onError ( $ message ) ; $ this -> dispatcher -> dispatch ( BarbeQEvents :: POST_CONSUME , $ consumeEvent ) ; // TODO
 throw new ConsumerIndigestionException ( "Error while consuming a message" , 0 , $ e ) ; } }
Dispatches a Message to all interested consumers

@param  MessageInterface $message

@throws ConsumerIndigestionException
Dispatches a Message to all interested consumers