Skip to content
Browse files

Some code cleanup

  • Loading branch information...
1 parent a86c232 commit 6010205dd003499fa9696b38104030d1bfee030b @vicb vicb committed Jun 2, 2012
Showing with 13 additions and 28 deletions.
  1. +2 −2 Command/ConsumerCommand.php
  2. +6 −6 Command/RpcServerCommand.php
  3. +0 −2 Command/StdInProducerCommand.php
  4. +5 −12 RabbitMq/Consumer.php
  5. +0 −6 RabbitMq/Producer.php
View
4 Command/ConsumerCommand.php
@@ -32,15 +32,15 @@ protected function configure()
*
* @return integer 0 if everything went fine, or an error code
*
- * @throws \LogicException When this abstract class is not implemented
+ * @throws \InvalidArgumentException When the number of messages to consume is less than 0
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
define('AMQP_DEBUG', (Boolean) $input->getOption('debug'));
$amount = $input->getOption('messages');
if (0 > $amount) {
- throw new InvalidArgumentException("The -m option should be null or greater than 0");
+ throw new \InvalidArgumentException("The -m option should be null or greater than 0");
}
$consumer = $this
View
12 Command/RpcServerCommand.php
@@ -31,19 +31,19 @@ protected function configure()
*
* @return integer 0 if everything went fine, or an error code
*
- * @throws \LogicException When this abstract class is not implemented
+ * @throws \InvalidArgumentException When the number of messages to consume is less than 0
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
define('AMQP_DEBUG', (bool) $input->getOption('debug'));
$amount = $input->getOption('messages');
if (0 > $amount) {
- throw new InvalidArgumentException("The -m option should be null or greater than 0");
+ throw new \InvalidArgumentException("The -m option should be null or greater than 0");
}
- $server = $this->getContainer()
- ->get(sprintf('old_sound_rabbit_mq.%s_server', $input->getArgument('name')))
- ->start($amount);
+ $this->getContainer()
+ ->get(sprintf('old_sound_rabbit_mq.%s_server', $input->getArgument('name')))
+ ->start($amount);
}
-}
+}
View
2 Command/StdInProducerCommand.php
@@ -29,8 +29,6 @@ protected function configure()
* @param OutputInterface $output An OutputInterface instance
*
* @return integer 0 if everything went fine, or an error code
- *
- * @throws \LogicException When this abstract class is not implemented
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
View
17 RabbitMq/Consumer.php
@@ -21,17 +21,10 @@ public function consume($msgAmount)
public function processMessage(AMQPMessage $msg)
{
- try
- {
- call_user_func($this->callback, $msg);
- $msg->delivery_info['channel']->basic_ack($msg->delivery_info['delivery_tag']);
- $this->consumed++;
- $this->maybeStopConsumer();
- }
- catch (\Exception $e)
- {
- throw $e;
- }
+ call_user_func($this->callback, $msg);
+ $msg->delivery_info['channel']->basic_ack($msg->delivery_info['delivery_tag']);
+ $this->consumed++;
+ $this->maybeStopConsumer();
}
-}
+}
View
6 RabbitMq/Producer.php
@@ -17,12 +17,6 @@ class Producer extends BaseAmqp
protected $declared = false;
- public function __construct(AMQPConnection $conn, AMQPChannel $ch = null, $consumerTag = null)
- {
- parent::__construct($conn, $ch, $consumerTag);
-
- }
-
public function setExchangeOptions(array $options = array())
{
$this->exchangeOptions = array_merge(

0 comments on commit 6010205

Please sign in to comment.
Something went wrong with that request. Please try again.