Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f53bddb

Browse files
committed
xMerge branch 'master' into bench
2 parents 392178d + 54eb61d commit f53bddb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+89
-60
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ Features:
7878

7979
## Resources
8080

81+
* [Site](https://enqueue.forma-pro.com/)
8182
* [Quick tour](docs/quick_tour.md)
8283
* [Documentation](docs/index.md)
8384
* [Blog](docs/index.md#blogs)

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "enqueue/enqueue-dev",
33
"type": "project",
44
"minimum-stability": "beta",
5-
"homepage": "https://github.com/php-enqueue/enqueue-dev",
5+
"homepage": "https://enqueue.forma-pro.com/",
66
"require": {
77
"php": ">=5.6",
88
"enqueue/enqueue": "*@dev",

docs/laravel/queues.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ return [
2222
'connection_factory_class' => \Enqueue\Fs\FsConnectionFactory::class,
2323

2424
// the factory specific options
25-
'dsn' => 'file://'.realpath(__DIR__.'/../storage').'/enqueue',
25+
'dsn' => 'file://'.storage_path('enqueue'),
2626
],
2727
],
2828
];

docs/laravel/quick_tour.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ The package allows you to use queue interop transport the [laravel way](https://
1111
You have to install `enqueue/laravel-queue` packages and one of the [supported transports](https://github.com/php-enqueue/enqueue-dev/tree/master/docs/transport).
1212

1313
```bash
14-
$ composer require enqueue/larvel-queue enqueue/fs
14+
$ composer require enqueue/laravel-queue enqueue/fs
1515
```
1616

1717
## Register service provider

pkg/amqp-bunny/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ This is an implementation of [amqp interop](https://github.com/queue-interop/amq
99

1010
## Resources
1111

12+
* [Site](https://enqueue.forma-pro.com/)
1213
* [Documentation](https://github.com/php-enqueue/enqueue-dev/blob/master/docs/index.md)
1314
* [Questions](https://gitter.im/php-enqueue/Lobby)
1415
* [Issue Tracker](https://github.com/php-enqueue/enqueue-dev/issues)

pkg/amqp-bunny/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"type": "library",
44
"description": "Message Queue Amqp Transport",
55
"keywords": ["messaging", "queue", "amqp", "bunny"],
6-
"homepage": "https://github.com/php-enqueue/enqueue-dev",
6+
"homepage": "https://enqueue.forma-pro.com/",
77
"license": "MIT",
88
"require": {
99
"php": ">=5.6",

pkg/amqp-ext/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ This is an implementation of [amqp interop](https://github.com/queue-interop/amq
99

1010
## Resources
1111

12+
* [Site](https://enqueue.forma-pro.com/)
1213
* [Documentation](https://github.com/php-enqueue/enqueue-dev/blob/master/docs/index.md)
1314
* [Questions](https://gitter.im/php-enqueue/Lobby)
1415
* [Issue Tracker](https://github.com/php-enqueue/enqueue-dev/issues)

pkg/amqp-ext/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"type": "library",
44
"description": "Message Queue Amqp Transport",
55
"keywords": ["messaging", "queue", "amqp"],
6-
"homepage": "https://github.com/php-enqueue/enqueue-dev",
6+
"homepage": "https://enqueue.forma-pro.com/",
77
"license": "MIT",
88
"require": {
99
"php": ">=5.6",

pkg/amqp-lib/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ This is an implementation of [amqp interop](https://github.com/queue-interop/amq
99

1010
## Resources
1111

12+
* [Site](https://enqueue.forma-pro.com/)
1213
* [Documentation](https://github.com/php-enqueue/enqueue-dev/blob/master/docs/index.md)
1314
* [Questions](https://gitter.im/php-enqueue/Lobby)
1415
* [Issue Tracker](https://github.com/php-enqueue/enqueue-dev/issues)

pkg/amqp-lib/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"type": "library",
44
"description": "Message Queue Amqp Transport",
55
"keywords": ["messaging", "queue", "amqp"],
6-
"homepage": "https://github.com/php-enqueue/enqueue-dev",
6+
"homepage": "https://enqueue.forma-pro.com/",
77
"license": "MIT",
88
"require": {
99
"php": ">=5.6",

pkg/amqp-tools/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ The tools could be used with any [amqp interop](https://github.com/queue-interop
1010

1111
## Resources
1212

13+
* [Site](https://enqueue.forma-pro.com/)
1314
* [Documentation](https://github.com/php-enqueue/enqueue-dev/blob/master/docs/index.md)
1415
* [Questions](https://gitter.im/php-enqueue/Lobby)
1516
* [Issue Tracker](https://github.com/php-enqueue/enqueue-dev/issues)

pkg/amqp-tools/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"type": "library",
44
"description": "Message Queue Amqp Tools",
55
"keywords": ["messaging", "queue", "amqp"],
6-
"homepage": "https://github.com/php-enqueue/enqueue-dev",
6+
"homepage": "https://enqueue.forma-pro.com/",
77
"license": "MIT",
88
"require": {
99
"php": ">=5.6",

pkg/async-event-dispatcher/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ It allows to processes events in background by sending them to MQ.
1010

1111
## Resources
1212

13+
* [Site](https://enqueue.forma-pro.com/)
1314
* [Documentation](https://github.com/php-enqueue/enqueue-dev/blob/master/docs/index.md)
1415
* [Questions](https://gitter.im/php-enqueue/Lobby)
1516
* [Issue Tracker](https://github.com/php-enqueue/enqueue-dev/issues)

pkg/async-event-dispatcher/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"type": "library",
44
"description": "Symfony async event dispatcher",
55
"keywords": ["messaging", "queue", "async event", "event dispatcher"],
6-
"homepage": "https://github.com/php-enqueue/enqueue-dev",
6+
"homepage": "https://enqueue.forma-pro.com/",
77
"license": "MIT",
88
"require": {
99
"php": ">=5.6",

pkg/dbal/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ This is an implementation of PSR specification. It allows you to send and consum
99

1010
## Resources
1111

12+
* [Site](https://enqueue.forma-pro.com/)
1213
* [Documentation](https://github.com/php-enqueue/enqueue-dev/blob/master/docs/index.md)
1314
* [Questions](https://gitter.im/php-enqueue/Lobby)
1415
* [Issue Tracker](https://github.com/php-enqueue/enqueue-dev/issues)

pkg/dbal/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"type": "library",
44
"description": "Message Queue Doctrine DBAL Transport",
55
"keywords": ["messaging", "queue", "doctrine", "dbal"],
6-
"homepage": "https://github.com/php-enqueue/enqueue-dev",
6+
"homepage": "https://enqueue.forma-pro.com/",
77
"license": "MIT",
88
"require": {
99
"php": ">=5.6",

pkg/enqueue-bundle/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Integrates message queue components to Symfony application.
99

1010
## Resources
1111

12+
* [Site](https://enqueue.forma-pro.com/)
1213
* [Quick tour](https://github.com/php-enqueue/enqueue-dev/blob/master/docs/bundle/quick_tour.md)
1314
* [Documentation](https://github.com/php-enqueue/enqueue-dev/blob/master/docs/index.md)
1415
* [Questions](https://gitter.im/php-enqueue/Lobby)

pkg/enqueue-bundle/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"type": "symfony-bundle",
44
"description": "Message Queue Bundle",
55
"keywords": ["messaging", "queue", "amqp", "rabbitmq"],
6-
"homepage": "https://github.com/php-enqueue/enqueue-dev",
6+
"homepage": "https://enqueue.forma-pro.com/",
77
"license": "MIT",
88
"require": {
99
"php": ">=5.6",

pkg/enqueue/Consumption/Extension/SignalExtension.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class SignalExtension implements ExtensionInterface
1818
protected $interruptConsumption = false;
1919

2020
/**
21-
* @var LoggerInterface
21+
* @var LoggerInterface|null
2222
*/
2323
protected $logger;
2424

@@ -84,7 +84,10 @@ public function onIdle(Context $context)
8484
public function interruptExecutionIfNeeded(Context $context)
8585
{
8686
if (false == $context->isExecutionInterrupted() && $this->interruptConsumption) {
87-
$this->logger->debug('[SignalExtension] Interrupt execution');
87+
if ($this->logger) {
88+
$this->logger->debug('[SignalExtension] Interrupt execution');
89+
}
90+
8891
$context->setExecutionInterrupted($this->interruptConsumption);
8992

9093
$this->interruptConsumption = false;
@@ -104,7 +107,10 @@ public function handleSignal($signal)
104107
case SIGTERM: // 15 : supervisor default stop
105108
case SIGQUIT: // 3 : kill -s QUIT
106109
case SIGINT: // 2 : ctrl+c
107-
$this->logger->debug('[SignalExtension] Interrupt consumption');
110+
if ($this->logger) {
111+
$this->logger->debug('[SignalExtension] Interrupt consumption');
112+
}
113+
108114
$this->interruptConsumption = true;
109115
break;
110116
default:

pkg/enqueue/Consumption/QueueConsumer.php

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -168,39 +168,47 @@ public function consume(ExtensionInterface $runtimeExtension = null)
168168
$logger = $context->getLogger() ?: new NullLogger();
169169
$logger->info('Start consuming');
170170

171-
while (true) {
172-
try {
173-
if ($this->psrContext instanceof AmqpContext) {
174-
$callback = function (AmqpMessage $message, AmqpConsumer $consumer) use ($extension, $logger, &$context) {
175-
$currentProcessor = null;
171+
if ($this->psrContext instanceof AmqpContext) {
172+
$callback = function (AmqpMessage $message, AmqpConsumer $consumer) use ($extension, $logger, &$context) {
173+
$currentProcessor = null;
174+
175+
/** @var PsrQueue $queue */
176+
foreach ($this->boundProcessors as list($queue, $processor)) {
177+
if ($queue->getQueueName() === $consumer->getQueue()->getQueueName()) {
178+
$currentProcessor = $processor;
179+
}
180+
}
176181

177-
/** @var PsrQueue $queue */
178-
foreach ($this->boundProcessors as list($queue, $processor)) {
179-
if ($queue->getQueueName() === $consumer->getQueue()->getQueueName()) {
180-
$currentProcessor = $processor;
181-
}
182-
}
182+
if (false == $currentProcessor) {
183+
throw new \LogicException(sprintf('The processor for the queue "%s" could not be found.', $consumer->getQueue()->getQueueName()));
184+
}
183185

184-
if (false == $currentProcessor) {
185-
throw new \LogicException(sprintf('The processor for the queue "%s" could not be found.', $consumer->getQueue()->getQueueName()));
186-
}
186+
$context = new Context($this->psrContext);
187+
$context->setLogger($logger);
188+
$context->setPsrQueue($consumer->getQueue());
189+
$context->setPsrConsumer($consumer);
190+
$context->setPsrProcessor($currentProcessor);
191+
$context->setPsrMessage($message);
187192

188-
$context = new Context($this->psrContext);
189-
$context->setLogger($logger);
190-
$context->setPsrQueue($consumer->getQueue());
191-
$context->setPsrConsumer($consumer);
192-
$context->setPsrProcessor($currentProcessor);
193-
$context->setPsrMessage($message);
193+
$this->doConsume($extension, $context);
194194

195-
$this->doConsume($extension, $context);
195+
return true;
196+
};
196197

197-
return true;
198-
};
198+
foreach ($consumers as $consumer) {
199+
/* @var AmqpConsumer $consumer */
199200

200-
foreach ($consumers as $consumer) {
201-
/* @var AmqpConsumer $consumer */
201+
$this->psrContext->subscribe($consumer, $callback);
202+
}
203+
}
202204

203-
$this->psrContext->subscribe($consumer, $callback);
205+
while (true) {
206+
try {
207+
if ($this->psrContext instanceof AmqpContext) {
208+
$extension->onBeforeReceive($context);
209+
210+
if ($context->isExecutionInterrupted()) {
211+
throw new ConsumptionInterruptedException();
204212
}
205213

206214
$this->psrContext->consume($this->receiveTimeout);
@@ -266,16 +274,14 @@ protected function doConsume(ExtensionInterface $extension, Context $context)
266274
$consumer = $context->getPsrConsumer();
267275
$logger = $context->getLogger();
268276

269-
if (false == $context->getPsrMessage() instanceof AmqpContext) {
270-
$extension->onBeforeReceive($context);
271-
}
272-
273277
if ($context->isExecutionInterrupted()) {
274278
throw new ConsumptionInterruptedException();
275279
}
276280

277281
$message = $context->getPsrMessage();
278282
if (false == $message) {
283+
$extension->onBeforeReceive($context);
284+
279285
if ($message = $consumer->receive($this->receiveTimeout)) {
280286
$context->setPsrMessage($message);
281287
}
@@ -312,10 +318,6 @@ protected function doConsume(ExtensionInterface $extension, Context $context)
312318
$logger->info(sprintf('Message processed: %s', $context->getResult()));
313319

314320
$extension->onPostReceived($context);
315-
316-
if ($context->getPsrMessage() instanceof AmqpContext) {
317-
$extension->onBeforeReceive($context);
318-
}
319321
} else {
320322
usleep($this->idleTimeout * 1000);
321323
$extension->onIdle($context);

pkg/enqueue/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Read more about it in documentation.
1111

1212
## Resources
1313

14+
* [Site](https://enqueue.forma-pro.com/)
1415
* [Documentation](https://github.com/php-enqueue/enqueue-dev/blob/master/docs/index.md)
1516
* [Questions](https://gitter.im/php-enqueue/Lobby)
1617
* [Issue Tracker](https://github.com/php-enqueue/enqueue-dev/issues)

pkg/enqueue/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"type": "library",
44
"description": "Message Queue Library",
55
"keywords": ["messaging", "queue", "amqp", "rabbitmq"],
6-
"homepage": "https://github.com/php-enqueue/enqueue-dev",
6+
"homepage": "https://enqueue.forma-pro.com/",
77
"license": "MIT",
88
"require": {
99
"php": ">=5.6",

pkg/fs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ This is an implementation of PSR queue specification. It allows you to send and
99

1010
## Resources
1111

12+
* [Site](https://enqueue.forma-pro.com/)
1213
* [Documentation](https://github.com/php-enqueue/enqueue-dev/blob/master/docs/index.md)
1314
* [Questions](https://gitter.im/php-enqueue/Lobby)
1415
* [Issue Tracker](https://github.com/php-enqueue/enqueue-dev/issues)

pkg/fs/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"type": "library",
44
"description": "Enqueue Filesystem based transport",
55
"keywords": ["messaging", "queue", "filesystem", "local"],
6-
"homepage": "https://github.com/php-enqueue/enqueue-dev",
6+
"homepage": "https://enqueue.forma-pro.com/",
77
"license": "MIT",
88
"require": {
99
"php": ">=5.6",

pkg/gearman/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ This is an implementation of the queue specification. It allows you to send and
99

1010
## Resources
1111

12+
* [Site](https://enqueue.forma-pro.com/)
1213
* [Documentation](https://github.com/php-enqueue/enqueue-dev/blob/master/docs/index.md)
1314
* [Questions](https://gitter.im/php-enqueue/Lobby)
1415
* [Issue Tracker](https://github.com/php-enqueue/enqueue-dev/issues)

pkg/gearman/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"type": "library",
44
"description": "Message Queue Gearman transport",
55
"keywords": ["messaging", "queue", "german"],
6-
"homepage": "https://github.com/php-enqueue/enqueue-dev",
6+
"homepage": "https://enqueue.forma-pro.com/",
77
"license": "MIT",
88
"require": {
99
"php": ">=5.6",

pkg/gps/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ This is an implementation of PSR specification. It allows you to send and consum
99

1010
## Resources
1111

12+
* [Site](https://enqueue.forma-pro.com/)
1213
* [Documentation](https://github.com/php-enqueue/enqueue-dev/blob/master/docs/index.md)
1314
* [Questions](https://gitter.im/php-enqueue/Lobby)
1415
* [Issue Tracker](https://github.com/php-enqueue/enqueue-dev/issues)

pkg/gps/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"type": "library",
44
"description": "Message Google Cloud Pub/Sub Transport",
55
"keywords": ["messaging", "queue", "google", "pubsub"],
6-
"homepage": "https://github.com/php-enqueue/enqueue-dev",
6+
"homepage": "https://enqueue.forma-pro.com/",
77
"license": "MIT",
88
"require": {
99
"php": ">=5.6",

pkg/job-queue/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Read more about it in documentation
1111

1212
## Resources
1313

14+
* [Site](https://enqueue.forma-pro.com/)
1415
* [Documentation](https://github.com/php-enqueue/enqueue-dev/blob/master/docs/index.md)
1516
* [Questions](https://gitter.im/php-enqueue/Lobby)
1617
* [Issue Tracker](https://github.com/php-enqueue/enqueue-dev/issues)

pkg/job-queue/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"type": "library",
44
"description": "Job Queue",
55
"keywords": ["messaging", "queue", "jobs"],
6-
"homepage": "https://github.com/php-enqueue/enqueue-dev",
6+
"homepage": "https://enqueue.forma-pro.com/",
77
"license": "MIT",
88
"require": {
99
"php": ">=5.6",

pkg/null/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ This is an implementation of PSR queue specification. It does not send messages
99

1010
## Resources
1111

12+
* [Site](https://enqueue.forma-pro.com/)
1213
* [Documentation](https://github.com/php-enqueue/enqueue-dev/blob/master/docs/index.md)
1314
* [Questions](https://gitter.im/php-enqueue/Lobby)
1415
* [Issue Tracker](https://github.com/php-enqueue/enqueue-dev/issues)

pkg/null/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"type": "library",
44
"description": "Enqueue Null transport",
55
"keywords": ["messaging", "queue", "testing"],
6-
"homepage": "https://github.com/php-enqueue/enqueue-dev",
6+
"homepage": "https://enqueue.forma-pro.com/",
77
"license": "MIT",
88
"require": {
99
"php": ">=5.6",

0 commit comments

Comments
 (0)