Skip to content

Commit e358fdc

Browse files
authored
Develop merge (#7)
* 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)
1 parent 2e1a1ae commit e358fdc

6 files changed

Lines changed: 8 additions & 9 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ The generated class will be inside `Job` folder inside the bundle that you chose
193193
<a name="class-structure"></a>
194194
### Job Structure
195195

196-
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:
196+
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:
197197

198198
<?php
199199

src/Command/ListenCommand.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use IdeasBucket\QueueBundle\Listener;
66
use IdeasBucket\QueueBundle\ListenerOptions;
7-
use Symfony\Component\Console\Command\Command;
7+
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
88
use Symfony\Component\Console\Input\InputArgument;
99
use Symfony\Component\Console\Input\InputOption;
1010
use Symfony\Component\Console\Output\OutputInterface;
@@ -15,7 +15,7 @@
1515
*
1616
* @package IdeasBucket\QueueBundle\Command
1717
*/
18-
class ListenCommand extends Command
18+
class ListenCommand extends ContainerAwareCommand
1919
{
2020
/**
2121
* Listener which listens for the incoming job.
@@ -54,7 +54,6 @@ protected function configure()
5454
->addArgument('connection', InputArgument::OPTIONAL, 'The name of connection')
5555
->addOption('queue', null, InputOption::VALUE_OPTIONAL, 'The queue to listen on', null)
5656
->addOption('delay', null, InputOption::VALUE_OPTIONAL, 'Amount of time to delay failed jobs', 0)
57-
->addOption('env', null, InputOption::VALUE_OPTIONAL, 'Environment that we need to run in', null)
5857
->addOption('memory', null, InputOption::VALUE_OPTIONAL, 'The memory limit in megabytes', 128)
5958
->addOption('timeout', null, InputOption::VALUE_OPTIONAL, 'Seconds a job may run before timing out', 60)
6059
->addOption('sleep', null, InputOption::VALUE_OPTIONAL, 'Seconds to wait before checking queue for jobs', 3)
@@ -134,7 +133,7 @@ protected function getQueue($queueName, $connection)
134133
protected function gatherOptions(InputInterface $input)
135134
{
136135
return new ListenerOptions(
137-
$input->getOption('env'),
136+
$this->getContainer()->getParameter('kernel.environment'),
138137
$input->getOption('delay'),
139138
$input->getOption('memory'),
140139
$input->getOption('timeout'),

src/Command/WorkCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ protected function configure()
100100
{
101101
$this->setName('idb_queue:work')
102102
->setDescription('Start processing jobs on the queue as a daemon')
103-
->addArgument('connection', InputArgument::OPTIONAL, 'The name of connection', 'null')
103+
->addArgument('connection', InputArgument::OPTIONAL, 'The name of connection')
104104
->addOption('queue', null, InputOption::VALUE_OPTIONAL, 'The queue to listen on', null)
105105
->addOption('once', null, InputOption::VALUE_NONE, 'Only process the next job on the queue')
106106
->addOption('delay', null, InputOption::VALUE_OPTIONAL, 'Amount of time to delay failed jobs', 0)

src/DependencyInjection/Configuration.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ public function getConfigTreeBuilder()
130130
->scalarNode('host')->end()
131131
->scalarNode('repository')->end()
132132
->scalarNode('prefix')->end()
133+
->scalarNode('endpoint')->end()
133134
->integerNode('timeout')->end()
134135
->integerNode('port')->end()
135136
->end()

src/DependencyInjection/IdeasBucketQueueExtension.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ public function load(array $configs, ContainerBuilder $container)
4444
$container->setAlias('ideasbucket_queue.redis_client', $mergedConfiguration['connections']['redis']['client']);
4545
}
4646

47-
$container->setAlias('idb_queue', 'ideasbucket_queue');
48-
4947
$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
5048
$loader->load('services.xml');
5149
$loader->load('connectors.xml');

src/Resources/config/services.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<argument type="service" id="event_dispatcher"/>
1616
<argument type="service" id="ideasbucket_queue.switch_service"/>
1717
</service>
18+
<service id="idb_queue" alias="ideasbucket_queue"></service>
1819
<service id="ideasbucket_queue.worker" class="IdeasBucket\QueueBundle\Worker" public="false">
1920
<argument type="service" id="ideasbucket_queue"/>
2021
<argument type="service" id="event_dispatcher"/>
@@ -24,4 +25,4 @@
2425
<argument type="expression">service(parameter('ideasbucket_queue.cache_driver'))</argument>
2526
</service>
2627
</services>
27-
</container>
28+
</container>

0 commit comments

Comments
 (0)