-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add handler factory support #8
Conversation
use Equip\Queue\Exception\RouterException; | ||
use Equip\Queue\RouterInterface; | ||
|
||
class Router implements RouterInterface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class needs a test suite.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For an example class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, didn't notice the path. Feel free to disregard. Though, is this implementation not usable on its own outside of being an example? Are we going to expect that library users will implement their own router classes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't plan on providing an implementation, but this one turned out alright. I'll add it.
use Equip\Queue\Exception\HandlerException; | ||
use Equip\Queue\Exception\RouterException; | ||
|
||
class SimpleRouter implements RouterInterface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this called a router and not factory?
use Equip\Queue\Exception\HandlerException; | ||
use Equip\Queue\Exception\RouterException; | ||
|
||
class SimpleRouteFactory implements RouteFactoryInterface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shadowhand better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But why is it called "Route" at all?
interface RouteFactoryInterface | ||
{ | ||
/** | ||
* Retrieve callable for message |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on this comment, it seems like this interface should be named HandlerFactoryInterface
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
*/ | ||
private $handlers; | ||
private $handler_factory; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$handler
, $factory
, or leave it as it is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's okay as is, though if you do rename it, I'd opt for $handlers
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like $handlers
better, updated.
|
||
/** | ||
* @param DriverInterface $driver | ||
* @param Event $event | ||
* @param LoggerInterface $logger | ||
* @param MessageSerializerInterface $serializer | ||
* @param RouteFactoryInterface $router | ||
* @param HandlerFactoryInterface $handler_factory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would use $handlers
👍 |
Adding handler factories ensures a clean slate when executing each job.