Closed xepozz closed 4 days ago
handlerName
to handler
in different classes and files for consistency. It affects the classes: Message
, Queue
, TestMiddleware
, and various test files. This also includes renaming the method getHandlerName
method to getHandler
in the MessageInterface
interface.FileDownloader
and Worker
Classes
handle
method in the FileDownloader
class will now output a MessageInterface
object. Also, the same method in the Worker
class will now throw a RuntimeException
if the handler name is not found, increasing error handling.handlers
Property and QueueWorker
Class
handlers
property has been removed from the Worker
class constructor, and the QueueWorker
class has been removed from di.php
file, simplifying the structure.MessageHandlerInterface
Interface
MessageHandlerInterface
interface was added, which is implemented by the FakeHandler
class, promoting code reusability and abstraction.MessageConsumingTest
and MiddlewareTest
Classes
MessageConsumingTest
and MiddlewareTest
now use different classes as the handler for messages (StackMessageHandler
and NullMessageHandler
respectively), which promotes diverse handling processes.ExceptionMessageHandler
, NullMessageHandler
, and StackMessageHandler
were added, enhancing the system's capabilities to handle diverse message types.getMessageHandlers
Method
getMessageHandlers
method was removed from TestCase
class, reducing redundancy in the codebase.MiddlewareDispatcherTest.php
, QueueTest.php
, SynchronousAdapterTest.php
, and WorkerTest.php
were modified, promoting better and diverse testing with modified handler values.Minor changes and adjustments were made throughout the codebase to align with these changes. Please ask if further clarification is needed.
Attention: Patch coverage is 45.45455%
with 12 lines
in your changes missing coverage. Please review.
Project coverage is 83.15%. Comparing base (
5339df8
) to head (725ef84
). Report is 22 commits behind head on master.
Files with missing lines | Patch % | Lines |
---|---|---|
src/Worker/Worker.php | 36.36% | 7 Missing :warning: |
config/di.php | 0.00% | 5 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
🚨 Try these New Features:
The idea was that handler is not a PHP class string because worker could be implemented in non-PHP.
Already discussed in the internal chat.
There're should be routing outside a message to be able to work with different services across the one queue.
With queue backends such as Redis, there's no external routing.
Discussed internally. It makes sense if we'll introduce "message type decorator" and "message-based handlers" for messages in a separate PR.
Reimplemented in #218, which supports both cases:
new Message(FooHandler::class, $data);
With no additional routing.
Drop support pre-configured handlers, make it compatible with validator/hydrator handlers way
The old way:
handler name
=>handler definition
mapping to config/paramshandler name
to the messagegetHandlerName
methodThe new way:
MessageHandlerInterface
getHandler
methodThe new way is similar with validator's or hydrator's way.