diff --git a/README.md b/README.md index 01d625a5..472ddb56 100644 --- a/README.md +++ b/README.md @@ -80,8 +80,8 @@ $queue->push($message); Its handler may look like the following: ```php -use Yiisoft\Yii\Queue\Message\MessageInterface; -use Yiisoft\Yii\Queue\Message\MessageHandlerInterface; +use Yiisoft\Queue\Message\MessageInterface; +use Yiisoft\Queue\Message\MessageHandlerInterface; class FileDownloader implements MessageHandlerInterface { diff --git a/src/Message/EnvelopeTrait.php b/src/Message/EnvelopeTrait.php index 13e593ab..3ffea959 100644 --- a/src/Message/EnvelopeTrait.php +++ b/src/Message/EnvelopeTrait.php @@ -21,9 +21,9 @@ public function withMessage(MessageInterface $message): self return $instance; } - public function getHandlerName(): string + public function getHandler(): string { - return $this->message->getHandlerName(); + return $this->message->getHandler(); } public function getData(): mixed diff --git a/src/Message/MessageHandlerInterface.php b/src/Message/MessageHandlerInterface.php index 65b5f9ae..7a8ab1f9 100644 --- a/src/Message/MessageHandlerInterface.php +++ b/src/Message/MessageHandlerInterface.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Yiisoft\Yii\Queue\Message; +namespace Yiisoft\Queue\Message; interface MessageHandlerInterface { diff --git a/src/Middleware/FailureHandling/FailureEnvelope.php b/src/Middleware/FailureHandling/FailureEnvelope.php index 3af8d24c..75b4eb7d 100644 --- a/src/Middleware/FailureHandling/FailureEnvelope.php +++ b/src/Middleware/FailureHandling/FailureEnvelope.php @@ -22,4 +22,5 @@ public function getMetadata(): array { return array_merge($this->message->getMetadata(), $this->meta); } + } diff --git a/src/Worker/Worker.php b/src/Worker/Worker.php index 7aab3956..0c3edde0 100644 --- a/src/Worker/Worker.php +++ b/src/Worker/Worker.php @@ -11,6 +11,7 @@ use Throwable; use Yiisoft\Injector\Injector; use Yiisoft\Queue\Exception\JobFailureException; +use Yiisoft\Queue\Message\MessageHandlerInterface; use Yiisoft\Queue\Message\MessageInterface; use Yiisoft\Queue\Middleware\Consume\ConsumeFinalHandler; use Yiisoft\Queue\Middleware\Consume\ConsumeMiddlewareDispatcher; diff --git a/tests/App/FakeHandler.php b/tests/App/FakeHandler.php index 49ba565c..c786d8a3 100644 --- a/tests/App/FakeHandler.php +++ b/tests/App/FakeHandler.php @@ -6,8 +6,7 @@ use Yiisoft\Queue\Message\MessageInterface; use RuntimeException; -use Yiisoft\Yii\Queue\Message\MessageHandlerInterface; -use Yiisoft\Yii\Queue\Message\MessageInterface; +use Yiisoft\Queue\Message\MessageHandlerInterface; final class FakeHandler implements MessageHandlerInterface { diff --git a/tests/Integration/MessageConsumingTest.php b/tests/Integration/MessageConsumingTest.php index 60ac01cc..0fd01e11 100644 --- a/tests/Integration/MessageConsumingTest.php +++ b/tests/Integration/MessageConsumingTest.php @@ -12,8 +12,10 @@ use Yiisoft\Queue\Middleware\Consume\MiddlewareFactoryConsumeInterface; use Yiisoft\Queue\Middleware\FailureHandling\FailureMiddlewareDispatcher; use Yiisoft\Queue\Middleware\FailureHandling\MiddlewareFactoryFailureInterface; +use Yiisoft\Queue\Tests\Support\StackMessageHandler; use Yiisoft\Queue\Tests\TestCase; use Yiisoft\Queue\Worker\Worker; +use Yiisoft\Test\Support\Container\SimpleContainer; final class MessageConsumingTest extends TestCase { diff --git a/tests/Integration/MiddlewareTest.php b/tests/Integration/MiddlewareTest.php index cbfa661b..7255adbd 100644 --- a/tests/Integration/MiddlewareTest.php +++ b/tests/Integration/MiddlewareTest.php @@ -9,6 +9,7 @@ use Psr\Container\ContainerInterface; use Psr\Log\LoggerInterface; use Yiisoft\Injector\Injector; +use Yiisoft\Queue\Tests\Support\NullMessageHandler; use Yiisoft\Test\Support\Container\SimpleContainer; use Yiisoft\Test\Support\Log\SimpleLogger; use Yiisoft\Queue\Adapter\SynchronousAdapter; diff --git a/tests/Support/ExceptionMessageHandler.php b/tests/Support/ExceptionMessageHandler.php index 91c7bff9..5222a609 100644 --- a/tests/Support/ExceptionMessageHandler.php +++ b/tests/Support/ExceptionMessageHandler.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace Yiisoft\Yii\Queue\Tests\Support; +namespace Yiisoft\Queue\Tests\Support; use RuntimeException; -use Yiisoft\Yii\Queue\Message\MessageHandlerInterface; -use Yiisoft\Yii\Queue\Message\MessageInterface; +use Yiisoft\Queue\Message\MessageHandlerInterface; +use Yiisoft\Queue\Message\MessageInterface; class ExceptionMessageHandler implements MessageHandlerInterface { diff --git a/tests/Support/NullMessageHandler.php b/tests/Support/NullMessageHandler.php index e2c70a10..911a5293 100644 --- a/tests/Support/NullMessageHandler.php +++ b/tests/Support/NullMessageHandler.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Yiisoft\Yii\Queue\Tests\Support; +namespace Yiisoft\Queue\Tests\Support; -use Yiisoft\Yii\Queue\Message\MessageHandlerInterface; -use Yiisoft\Yii\Queue\Message\MessageInterface; +use Yiisoft\Queue\Message\MessageHandlerInterface; +use Yiisoft\Queue\Message\MessageInterface; class NullMessageHandler implements MessageHandlerInterface { diff --git a/tests/Support/StackMessageHandler.php b/tests/Support/StackMessageHandler.php index 65e159df..36e80ad4 100644 --- a/tests/Support/StackMessageHandler.php +++ b/tests/Support/StackMessageHandler.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Yiisoft\Yii\Queue\Tests\Support; +namespace Yiisoft\Queue\Tests\Support; -use Yiisoft\Yii\Queue\Message\MessageHandlerInterface; -use Yiisoft\Yii\Queue\Message\MessageInterface; +use Yiisoft\Queue\Message\MessageHandlerInterface; +use Yiisoft\Queue\Message\MessageInterface; class StackMessageHandler implements MessageHandlerInterface { diff --git a/tests/TestCase.php b/tests/TestCase.php index d0fcd8d9..acc2d9ac 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -24,6 +24,8 @@ use Yiisoft\Queue\Queue; use Yiisoft\Queue\Worker\Worker; use Yiisoft\Queue\Worker\WorkerInterface; +use Yiisoft\Queue\Tests\Support\NullMessageHandler; +use Yiisoft\Queue\Tests\Support\StackMessageHandler; /** * Base Test Case. diff --git a/tests/Unit/QueueTest.php b/tests/Unit/QueueTest.php index 5edf5c5e..c5f4fb6e 100644 --- a/tests/Unit/QueueTest.php +++ b/tests/Unit/QueueTest.php @@ -10,6 +10,8 @@ use Yiisoft\Queue\Tests\App\FakeAdapter; use Yiisoft\Queue\Tests\TestCase; use Yiisoft\Queue\Message\IdEnvelope; +use Yiisoft\Queue\Tests\Support\NullMessageHandler; +use Yiisoft\Queue\Tests\Support\StackMessageHandler; final class QueueTest extends TestCase { diff --git a/tests/Unit/SynchronousAdapterTest.php b/tests/Unit/SynchronousAdapterTest.php index 67372fdf..9d079550 100644 --- a/tests/Unit/SynchronousAdapterTest.php +++ b/tests/Unit/SynchronousAdapterTest.php @@ -9,6 +9,7 @@ use Yiisoft\Queue\QueueFactory; use Yiisoft\Queue\Tests\TestCase; use Yiisoft\Queue\Message\IdEnvelope; +use Yiisoft\Queue\Tests\Support\NullMessageHandler; final class SynchronousAdapterTest extends TestCase { diff --git a/tests/Unit/WorkerTest.php b/tests/Unit/WorkerTest.php index 077954ab..4ca884c0 100644 --- a/tests/Unit/WorkerTest.php +++ b/tests/Unit/WorkerTest.php @@ -20,6 +20,8 @@ use Yiisoft\Queue\Tests\App\FakeHandler; use Yiisoft\Queue\Tests\TestCase; use Yiisoft\Queue\Worker\Worker; +use Yiisoft\Queue\Tests\Support\ExceptionMessageHandler; +use Yiisoft\Queue\Tests\Support\StackMessageHandler; final class WorkerTest extends TestCase {