Knp\Bundle\KnpBundlesBundle\Producer\ExecutorProducer::publish PHP Method

publish() public method

public publish ( $msgBody, $routingKey = '' )
    public function publish($msgBody, $routingKey = '')
    {
        $msg = new AMQPMessage($msgBody);
        $this->consumer->execute($msg);
    }

Usage Example

 public function testExecution()
 {
     $consumer = $this->getMock('OldSound\\RabbitMqBundle\\RabbitMq\\ConsumerInterface');
     $consumer->expects($this->once())->method('execute');
     $producer = new ExecutorProducer($consumer);
     $producer->publish('a message');
 }
ExecutorProducer