Skip to content

[Messenger] Add Beanstalkd bridge #36582

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 1 commit into from
Aug 13, 2020

Conversation

X-Coder264
Copy link
Contributor

@X-Coder264 X-Coder264 commented Apr 25, 2020

Q A
Branch? master
Bug fix? no
New feature? yes
Deprecations? no
Tickets
License MIT
Doc PR

On a project at work we use Beanstalkd and we wanted to start using Messenger with it so I've written this bridge/transport. Any feedback is highly appreciated.

@X-Coder264 X-Coder264 requested a review from sroze as a code owner April 25, 2020 20:25
@X-Coder264 X-Coder264 force-pushed the beanstalkd-messenger-bridge branch 3 times, most recently from 75032c8 to 30be838 Compare April 25, 2020 21:33
private $connection;
private $serializer;

public function __construct(Connection $connection, SerializerInterface $serializer)
Copy link
Contributor

Choose a reason for hiding this comment

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

Serializer can be nullable here no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@X-Coder264 X-Coder264 force-pushed the beanstalkd-messenger-bridge branch 2 times, most recently from 1b53ed7 to 2a5bbf3 Compare April 26, 2020 10:53
@chalasr chalasr added this to the next milestone Apr 26, 2020
@X-Coder264 X-Coder264 force-pushed the beanstalkd-messenger-bridge branch from 2a5bbf3 to b34ef75 Compare April 28, 2020 22:47
@X-Coder264 X-Coder264 force-pushed the beanstalkd-messenger-bridge branch 2 times, most recently from 3bd5d9c to de8f23d Compare August 8, 2020 20:24
@X-Coder264
Copy link
Contributor Author

X-Coder264 commented Aug 8, 2020

PR rebased with master.

I don't understand why the Travis PHP 7.2 build fails with the message PHP Fatal error: Class 'Pheanstalk\Contract\PheanstalkInterface' not found in /home/travis/build/symfony/symfony/src/Symfony/Component/Messenger/Bridge/Beanstalkd/Tests/Transport/ConnectionTest.php on line 42 even though Pheanstalk is required by the package. The 7.3 and 7.4 jobs are passing.

I've been using it for months on production and it is working great.

Copy link
Member

@fabpot fabpot left a comment

Choose a reason for hiding this comment

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

Haven't had time to do a full review. Just spotted one change for now.

@@ -19,6 +19,7 @@
"php": ">=7.2.5",
"psr/log": "~1.0",
"symfony/amqp-messenger": "^5.1",
"symfony/beanstalkd-messenger": "^5.2",
Copy link
Member

Choose a reason for hiding this comment

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

Should be removed. The idea is to add it only when needed.We do have AMQP for BC reasons.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh right, removed.

Copy link
Member

@fabpot fabpot left a comment

Choose a reason for hiding this comment

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

LGTM (with some very minor comments)

@@ -0,0 +1,12 @@
Beanstalkd Messenger
===============
Copy link
Member

Choose a reason for hiding this comment

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

Missing some = chars

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've added the missing = chars.

* * ttr: the message time to run before it is put back in the ready queue (in seconds)
*/
private $configuration;

Copy link
Member

Choose a reason for hiding this comment

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

blank line can be removed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed.

Copy link
Member

@fabpot fabpot left a comment

Choose a reason for hiding this comment

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

@X-Coder264 Can you work on fixing the test now? I suppose that we need to install Beanstalkd on Travis.

@X-Coder264
Copy link
Contributor Author

X-Coder264 commented Aug 13, 2020

@fabpot You mean this failure? https://travis-ci.org/github/symfony/symfony/jobs/717325508
This happens only on the PHP 7.2 build, but I don't understand why since the Pheanstalk library is required by the bridge.
On the PHP 7.4 build I can see

cd src/Symfony/Component/Messenger/Bridge/Beanstalkd

+'[' -e composer.lock ']'

+composer install --no-progress --no-suggest --ansi

Loading composer repositories with package information

Installing dependencies (including require-dev) from lock file

Package operations: 7 installs, 0 updates, 0 removals

  - Installing pda/pheanstalk (v4.0.0): Downloading (100%)

  - Installing psr/log (1.0.0): Loading from cache

  - Installing symfony/messenger (v4.4.0): Loading from cache

  - Installing symfony/inflector (v3.4.0): Loading from cache

  - Installing symfony/property-access (v4.4.0): Loading from cache

  - Installing symfony/polyfill-ctype (v1.8.0): Loading from cache

  - Installing symfony/serializer (v4.4.0): Loading from cache

+/home/travis/build/symfony/symfony/phpunit --exclude-group tty,benchmark,intl-data

And all the Beanstalkd bridge tests pass there.

The PHP 7.2 build does not do that, it just runs

/home/travis/build/symfony/symfony/phpunit --exclude-group tty,benchmark,intl-data src/Symfony/Component/Messenger/Bridge/Beanstalkd

I'm not familiar with your Travis CI setup so I'll have to dig a bit deeper into it to check why composer install doesn't happen on the 7.2 build (from the look of it it seems like the 7.2 build is triggering some other code path in .travis.yml).

@fabpot
Copy link
Member

fabpot commented Aug 13, 2020

@X-Coder264 You need to add "pda/pheanstalk": "^4.0", in the require-dev section of the main/root composer.json.

@X-Coder264 X-Coder264 force-pushed the beanstalkd-messenger-bridge branch from e786645 to 8e6d0df Compare August 13, 2020 07:43
@X-Coder264
Copy link
Contributor Author

@X-Coder264 You need to add "pda/pheanstalk": "^4.0", in the require-dev section of the main/root composer.json.

Thanks for the tip - I've added it.

@fabpot
Copy link
Member

fabpot commented Aug 13, 2020

Thank you @X-Coder264.

@fabpot fabpot merged commit 6805d1d into symfony:master Aug 13, 2020
@X-Coder264 X-Coder264 deleted the beanstalkd-messenger-bridge branch August 13, 2020 08:22
@X-Coder264
Copy link
Contributor Author

@fabpot Thanks for the merge. I'll create a PR for the documentation this weekend.

@nicolas-grekas nicolas-grekas modified the milestones: next, 5.2 Oct 5, 2020
@fabpot fabpot mentioned this pull request Oct 5, 2020
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.

6 participants