Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Messenger] Add a --bus option to the messenger:consume-messages command #28190

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

Merged
merged 2 commits into from
Aug 29, 2018

Conversation

chalasr
Copy link
Member

@chalasr chalasr commented Aug 10, 2018

Q A
Branch? master
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets n/a
License MIT
Doc PR todo

Making it compatible with the multi-bus feature.

$buses[$busId] = new Reference($busId);
}
$container->getDefinition('console.command.messenger_consume_messages')->replaceArgument(0, ServiceLocatorTagPass::register($container, $buses));
$container->getDefinition('console.command.messenger_consume_messages')->replaceArgument(4, $busIds);
Copy link
Contributor

Choose a reason for hiding this comment

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

spare out an additional getDefinition call by chaining the 2nd replaceArgument?

Copy link
Member Author

Choose a reason for hiding this comment

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

Must be the heatwave 😅

if ($alternatives = $this->findAlternatives($busName, $this->receiverNames)) {
$style->block(sprintf('Bus "%s" is not defined.', $receiverName), null, 'error', ' ', true);
if ($style->confirm(sprintf('Do you want to dispatch to "%s" instead? ', $alternatives[0]), false)) {
$input->setArgument('receiver', $alternatives[0]);
Copy link
Contributor

Choose a reason for hiding this comment

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

this should set the bus option no? Also it's at least weird to pick the first one instead of presenting a choice question here.

Copy link
Contributor

@sroze sroze left a comment

Choose a reason for hiding this comment

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

Definitely to be added 👍

$style = new SymfonyStyle($input, $output);
if (null === $receiverName) {
$style->block('Missing receiver argument.', null, 'error', ' ', true);
$input->setArgument('receiver', $style->choice('Select one of the available receivers', $this->receiverNames));
Copy link
Contributor

Choose a reason for hiding this comment

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

You could set the $receiverName variable here, nah?


public function __construct(MessageBusInterface $bus, ContainerInterface $receiverLocator, LoggerInterface $logger = null, array $receiverNames = array())
public function __construct(ContainerInterface $busLocator, ContainerInterface $receiverLocator, LoggerInterface $logger = null, array $receiverNames = array(), array $busNames = array())
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a BC break. Can you update the UPGRADE file?

Copy link
Member

Choose a reason for hiding this comment

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

@sroze Can you add a note in the CHANGELOG?

@chalasr chalasr force-pushed the consume-multi-bus branch from c7dec58 to 2f873f1 Compare August 13, 2018 11:17
@sroze sroze force-pushed the consume-multi-bus branch 2 times, most recently from 3ca0dbd to 0fb758d Compare August 26, 2018 13:38
<argument type="service" id="messenger.receiver_locator" />
<argument type="service" id="logger" on-invalid="null" />
<argument>null</argument> <!-- Default receiver name -->
<argument type="collection" /> <!-- Message buses names -->
Copy link
Member

Choose a reason for hiding this comment

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

message bus names

Copy link
Contributor

Choose a reason for hiding this comment

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

@fabpot typo fixed.


public function __construct(MessageBusInterface $bus, ContainerInterface $receiverLocator, LoggerInterface $logger = null, array $receiverNames = array())
public function __construct(ContainerInterface $busLocator, ContainerInterface $receiverLocator, LoggerInterface $logger = null, array $receiverNames = array(), array $busNames = array())
Copy link
Member

Choose a reason for hiding this comment

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

@sroze Can you add a note in the CHANGELOG?

@chalasr chalasr force-pushed the consume-multi-bus branch from 99a4f5f to b077e78 Compare August 28, 2018 08:30
@chalasr chalasr force-pushed the consume-multi-bus branch from b077e78 to e3f1eec Compare August 28, 2018 09:10
@chalasr
Copy link
Member Author

chalasr commented Aug 28, 2018

CHANGELOG updated and deps=low build fixed (remaining failures unrelated). Ready, thanks @sroze for the commit.

@fabpot
Copy link
Member

fabpot commented Aug 29, 2018

Thank you @chalasr.

@fabpot fabpot merged commit e3f1eec into symfony:master Aug 29, 2018
fabpot added a commit that referenced this pull request Aug 29, 2018
…e-messages command (chalasr, sroze)

This PR was merged into the 4.2-dev branch.

Discussion
----------

[Messenger] Add a --bus option to the messenger:consume-messages command

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | todo

Making it compatible with the multi-bus feature.

Commits
-------

e3f1eec Bus argument is a required option when multiple buses are defined
539cb62 [Messenger] Add a --bus option to the messenger:consume-messages command
@chalasr chalasr deleted the consume-multi-bus branch August 29, 2018 10:53
@nicolas-grekas
Copy link
Member

@symfony/deciders: right now, our CI is broken since several days because of this BC break. This means breaking BC is more painful than writing a proper BC layer. With this bad experience in mind, I'd suggest stopping doing BC breaks even if the component is experimental. I don't know how to fix the current failures, while I know how to write proper BC layers.

@sroze @chalasr help wanted.

@nicolas-grekas
Copy link
Member

I'd suggest reverting #28328 and replacing the BC break introduced here by a proper BC layer.

@fabpot
Copy link
Member

fabpot commented Sep 2, 2018

What about restricting the version constrains in Composer instead? That would better reflect the experimental status of the component.

@lsmith77
Copy link
Contributor

lsmith77 commented Sep 2, 2018

maybe a strategy could be to add a BC layer and semi-regular intervals work on removing (parts of the) the BC layer again ensuring the test suite isn’t broken. this could help maintain development speed.

another approach could be to simply move the developmen to another repo and resync only when the test suite is fixed in the PR.

@nicolas-grekas
Copy link
Member

The CI did catch the breakage. Doing things in a separate repo might make things harder I fear. Having framework-bundle 4.1 accept only messenger 4.1 is a strategy that would work yes. Currently, breaking BC is painful, which is a good thing actually, since it should be. But maybe not for an experimental component. Do you confirm we should go this way @fabpot? I can then revert #28328 and replace it with a conflict >=4.2 rule instead.

@sroze
Copy link
Contributor

sroze commented Sep 2, 2018

I don't think it makes sense to revert #28328 as it's a valid change.
I definitely agree that I didn't either see such BC break to be that of a problem.
I also agree that sticking with FWB 4.1 == Messenger 4.1 makes sense, it's probably the easiest solution for such "experimental component".

@fabpot
Copy link
Member

fabpot commented Sep 2, 2018

I confirm that restricting the version constraints is the way to go IMHO.

nicolas-grekas added a commit that referenced this pull request Sep 2, 2018
…the PR #28190 (sroze)

This PR was merged into the 4.2-dev branch.

Discussion
----------

[Messenger] Ensure the tests and implementation matches the PR #28190

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #28190
| License       | MIT
| Doc PR        | ø

And we should have master green.

Commits
-------

ba62485 Ensure the tests and implementation matches the merged #28190 PR
@nicolas-grekas nicolas-grekas modified the milestones: next, 4.2 Nov 1, 2018
This was referenced Nov 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants