Skip to content
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

Update to use equip/command #9

Merged
merged 10 commits into from
Aug 26, 2016
Merged

Update to use equip/command #9

merged 10 commits into from
Aug 26, 2016

Conversation

ameech
Copy link
Contributor

@ameech ameech commented Aug 26, 2016

Using commands will simplify adding messages to a queue as well as allow us to typehint better within the handlers.

Also, adding this will allow you to convert an equip/command version 2 command to a background job quite easily.

TODO

  • Finish tests

@ameech
Copy link
Contributor Author

ameech commented Aug 26, 2016

@equip/contributors care to take a look?

use Equip\Command\OptionsSerializerTrait;
use Equip\Queue\Exception\MessageException;

abstract class AbstractMessage implements OptionsInterface

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the message used as the options?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be renamed, it was when I previous had it as an interface. Will update.

public function command()
{
if (!$this->command) {
throw MessageException::missingProperty('command');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't love the validation happening so late, any ideas?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think there's really a way to make it happen earlier without adding a constructor that handles validation.

@shadowhand
Copy link

I don't really understand the implementation as suggested. Why isn't it more akin to...?

$queue->add(FooCommand::class, new FooOptions(...));

Currently it looks like you need to wrap the command/options within a message object (which implements options for some reason?) and then pass that to the queue. The current implementation confuses me. Can you explain what the intent here is, @ameech ?

use Equip\Queue\Exception\CommandException;
use Equip\Queue\Exception\HandlerException;

interface CommandFactoryInterface

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure this is necessary.

use Equip\Command\CommandInterface;
use Equip\Queue\Exception\CommandException;

class AurynCommandFactory

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this supposed to implement something?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦆 nope.

@shadowhand
Copy link

Looks pretty good, just a couple of little things.

@shadowhand
Copy link

👍

"league/event": "^2.1",
"psr/log": "^1.0"
"psr/log": "^1.0",
"rdlowrey/auryn": "^1.4"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure we want to require this versus suggesting it / including it as a dev dependency.

Copy link
Contributor Author

@ameech ameech Aug 26, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we only have AurynCommandFactory and no CommandFactoryInterface, I figured it's best to add it.

It's back!

@elazar
Copy link

elazar commented Aug 26, 2016

@ameech Only think I might suggest is to add a section to the README on implementing CommandFactoryInterface, though that's not critical. Otherwise, looks good.

@elazar
Copy link

elazar commented Aug 26, 2016

👍

@ameech
Copy link
Contributor Author

ameech commented Aug 26, 2016

I plan to come back and make the docs better, they're pretty weak right now.

@ameech ameech merged commit 0b4c0a5 into master Aug 26, 2016
@ameech ameech deleted the feature/use-commands branch August 26, 2016 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants