Skip to content

Commit

Permalink
Develop merge (#7)
Browse files Browse the repository at this point in the history
* Use same defaults as listen command (#6)

* Set alias in services.xml (#5)

* Env is already defined (#4)

* Added endpoint to configuration (#3)

* Update fire method in doc (#2)
  • Loading branch information
nicholasnet authored Apr 21, 2017
1 parent 2e1a1ae commit e358fdc
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ The generated class will be inside `Job` folder inside the bundle that you chose
<a name="class-structure"></a>
### Job Structure

Job classes are very simple, it simply implements Queueable interface containing only a `handle` method which is called when the job is processed by the queue. To get started, let's take a look at an example job class. In this example, we'll send email using queue:
Job classes are very simple, it simply implements Queueable interface containing only a `fire` method which is called when the job is processed by the queue. To get started, let's take a look at an example job class. In this example, we'll send email using queue:

<?php

Expand Down
7 changes: 3 additions & 4 deletions src/Command/ListenCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use IdeasBucket\QueueBundle\Listener;
use IdeasBucket\QueueBundle\ListenerOptions;
use Symfony\Component\Console\Command\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
Expand All @@ -15,7 +15,7 @@
*
* @package IdeasBucket\QueueBundle\Command
*/
class ListenCommand extends Command
class ListenCommand extends ContainerAwareCommand
{
/**
* Listener which listens for the incoming job.
Expand Down Expand Up @@ -54,7 +54,6 @@ protected function configure()
->addArgument('connection', InputArgument::OPTIONAL, 'The name of connection')
->addOption('queue', null, InputOption::VALUE_OPTIONAL, 'The queue to listen on', null)
->addOption('delay', null, InputOption::VALUE_OPTIONAL, 'Amount of time to delay failed jobs', 0)
->addOption('env', null, InputOption::VALUE_OPTIONAL, 'Environment that we need to run in', null)
->addOption('memory', null, InputOption::VALUE_OPTIONAL, 'The memory limit in megabytes', 128)
->addOption('timeout', null, InputOption::VALUE_OPTIONAL, 'Seconds a job may run before timing out', 60)
->addOption('sleep', null, InputOption::VALUE_OPTIONAL, 'Seconds to wait before checking queue for jobs', 3)
Expand Down Expand Up @@ -134,7 +133,7 @@ protected function getQueue($queueName, $connection)
protected function gatherOptions(InputInterface $input)
{
return new ListenerOptions(
$input->getOption('env'),
$this->getContainer()->getParameter('kernel.environment'),
$input->getOption('delay'),
$input->getOption('memory'),
$input->getOption('timeout'),
Expand Down
2 changes: 1 addition & 1 deletion src/Command/WorkCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ protected function configure()
{
$this->setName('idb_queue:work')
->setDescription('Start processing jobs on the queue as a daemon')
->addArgument('connection', InputArgument::OPTIONAL, 'The name of connection', 'null')
->addArgument('connection', InputArgument::OPTIONAL, 'The name of connection')
->addOption('queue', null, InputOption::VALUE_OPTIONAL, 'The queue to listen on', null)
->addOption('once', null, InputOption::VALUE_NONE, 'Only process the next job on the queue')
->addOption('delay', null, InputOption::VALUE_OPTIONAL, 'Amount of time to delay failed jobs', 0)
Expand Down
1 change: 1 addition & 0 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ public function getConfigTreeBuilder()
->scalarNode('host')->end()
->scalarNode('repository')->end()
->scalarNode('prefix')->end()
->scalarNode('endpoint')->end()
->integerNode('timeout')->end()
->integerNode('port')->end()
->end()
Expand Down
2 changes: 0 additions & 2 deletions src/DependencyInjection/IdeasBucketQueueExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ public function load(array $configs, ContainerBuilder $container)
$container->setAlias('ideasbucket_queue.redis_client', $mergedConfiguration['connections']['redis']['client']);
}

$container->setAlias('idb_queue', 'ideasbucket_queue');

$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.xml');
$loader->load('connectors.xml');
Expand Down
3 changes: 2 additions & 1 deletion src/Resources/config/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<argument type="service" id="event_dispatcher"/>
<argument type="service" id="ideasbucket_queue.switch_service"/>
</service>
<service id="idb_queue" alias="ideasbucket_queue"></service>
<service id="ideasbucket_queue.worker" class="IdeasBucket\QueueBundle\Worker" public="false">
<argument type="service" id="ideasbucket_queue"/>
<argument type="service" id="event_dispatcher"/>
Expand All @@ -24,4 +25,4 @@
<argument type="expression">service(parameter('ideasbucket_queue.cache_driver'))</argument>
</service>
</services>
</container>
</container>

0 comments on commit e358fdc

Please sign in to comment.