-
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c849e34
commit af5f096
Showing
26 changed files
with
134 additions
and
1,000 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,14 @@ | ||
<?php | ||
|
||
use Yiisoft\Factory\Definitions\Reference; | ||
use Yiisoft\Serializer\PhpSerializer; | ||
use Yiisoft\Serializer\SerializerInterface; | ||
use Yiisoft\Yii\Queue\Drivers\Sync\Queue; | ||
use Psr\EventDispatcher\EventDispatcherInterface; | ||
use Psr\EventDispatcher\ListenerProviderInterface; | ||
use Yiisoft\EventDispatcher\Dispatcher\Dispatcher; | ||
use Yiisoft\EventDispatcher\Provider\Provider; | ||
use Yiisoft\Yii\Queue\Workers\Worker as QueueWorker; | ||
use Yiisoft\Yii\Queue\Workers\WorkerInterface; | ||
|
||
return [ | ||
// 'queue' => [ | ||
// '__class' => Queue::class, | ||
// ], | ||
// SerializerInterface::class => Reference::to('queue.serializer'), | ||
// 'queue.serializer' => [ | ||
// '__class' => PhpSerializer::class, | ||
// ], | ||
EventDispatcherInterface::class => Dispatcher::class, | ||
WorkerInterface::class => QueueWorker::class, | ||
ListenerProviderInterface::class => Provider::class, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,5 @@ | ||
<?php | ||
|
||
use Yiisoft\Factory\Definitions\Reference; | ||
declare(strict_types=1); | ||
|
||
return [ | ||
// 'app' => [ | ||
// 'bootstrap' => [ | ||
// 'queue' => 'queue', | ||
// ], | ||
// ], | ||
// \PDO::class => Reference::to('pdo'), | ||
// 'pdo' => [ | ||
// '__class' => \PDO::class, | ||
// '__construct()' => [ | ||
// 'dsn' => 'pgsql:dbname='.$params['db.name'] | ||
// .(!empty($params['db.host']) ? (';host='.$params['db.host']) : '') | ||
// .(!empty($params['db.port']) ? (';port='.$params['db.port']) : ''), | ||
// 'username' => $params['db.user'], | ||
// 'password' => $params['db.password'], | ||
// 'options' => [], | ||
// ], | ||
// ], | ||
// \yii\mutex\Mutex::class => Reference::to('mutex'), | ||
// 'mutex' => [ | ||
// '__class' => \yii\mutex\MysqlMutex::class, | ||
// ], | ||
]; | ||
return []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yiisoft\Yii\Queue\Tests\App; | ||
|
||
use RuntimeException; | ||
|
||
class ExceptionalSimpleJob extends SimpleJob | ||
{ | ||
public function execute(): void | ||
{ | ||
parent::execute(); | ||
throw new RuntimeException('Test exception'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,31 +8,19 @@ | |
|
||
namespace Yiisoft\Yii\Queue\Tests\App; | ||
|
||
use yii\base\BaseObject; | ||
use yii\helpers\Yii; | ||
use Yiisoft\Yii\Queue\JobInterface; | ||
use Yiisoft\Yii\Queue\Jobs\JobInterface; | ||
|
||
/** | ||
* Simple Job. | ||
* | ||
* @author Roman Zhuravlev <[email protected]> | ||
*/ | ||
class SimpleJob extends BaseObject implements JobInterface | ||
class SimpleJob implements JobInterface | ||
{ | ||
public $uid; | ||
public bool $executed = false; | ||
|
||
public function __construct($uid = null) | ||
public function execute(): void | ||
{ | ||
$this->uid = $uid; | ||
} | ||
|
||
public function execute($queue) | ||
{ | ||
file_put_contents($this->getFileName(), ''); | ||
} | ||
|
||
public function getFileName() | ||
{ | ||
return Yii::getAlias("@runtime/job-{$this->uid}.lock"); | ||
$this->executed = true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,4 @@ | ||
<?php | ||
|
||
use Yiisoft\Factory\Definitions\Reference; | ||
use Yiisoft\Mutex\File\FileMutex; | ||
use Yiisoft\Mutex\Mutex as YiiMutex; | ||
use Yiisoft\Yii\Queue\Drivers\Interop\Queue as InteropQueue; | ||
use Yiisoft\Yii\Queue\Drivers\Sync\Queue as SyncQueue; | ||
|
||
return [ | ||
'aliases' => [ | ||
'@runtime' => dirname(__DIR__, 2) . '/runtime', | ||
], | ||
|
||
'syncQueue' => [ | ||
'__class' => SyncQueue::class, | ||
], | ||
YiiMutex::class => Reference::to('mutex-file'), | ||
'mutex-file' => [ | ||
'__class' => FileMutex::class, | ||
'__construct()' => [ | ||
'mutexPath' => dirname(__DIR__, 2) . '/runtime/mutex', | ||
], | ||
], | ||
'interopQueue' => [ | ||
'__class' => InteropQueue::class, | ||
'host' => getenv('RABBITMQ_HOST') ?: 'localhost', | ||
'user' => getenv('RABBITMQ_USER') ?: 'guest', | ||
'password' => getenv('RABBITMQ_PASSWORD') ?: 'guest', | ||
'queueName' => 'queue-interop', | ||
'exchangeName' => 'exchange-interop', | ||
], | ||
]; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.