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

Fix/refactor creation of RabbitMQ Connection and QueueAPI #528

Merged
merged 27 commits into from
Apr 11, 2023

Conversation

adm-bome
Copy link
Collaborator

@adm-bome adm-bome commented Mar 11, 2023

Refactor:

Creating Connection with config via a factory.
Creating QueueAPI with config via a factory.

Prepaired the library for deprication of the AMQPLazyConnection:class

This is an Minor update
The code respects the old way connection and QueueApi were created. In a Major version some code can be removed when decided not supporting the old depricated AMQPLazyConnection::class

The previous versions where not realy Lazy. As soon as the QueueApi class (RabbitMQQueue::class) was created a channel was opened up. ( in the contruction) and when that happens the connection to RabbitMQ was open or "connected".
This version builds all classes but only opens the connection when a channel is needed (push, pop....)

Maybe this refactor also will help with the Octane problem of a connection being closed by RabbitMQ. (don´t no for sure.) but Lazy should be lazy 😉

#513, #521, #527, #487 and #460

adm-bome added 12 commits March 2, 2023 19:09
  - factory for making a queue.
  - default config object
  - rabbitmq queue contract

fixed:
  - code quality issues
  - tests (for checking moved config items)

removed:
  - unnecessary config
  - unnecessary methods for returning just the config
 - reverted config tests
 - private config getter
 - phpdoc tags
  - factory for making a connection.
  - factory for creating a config object.
  - test lazy stream connection.
fixed:
  - tests

removed:
  - unnecessary methods
 - reverted to minimal requirement update
 - reverted to minimal requirement update
  - factory for creating a config object.

fixed:
  - tests

removed:
  - unnecessary methods
@adm-bome adm-bome requested review from M-Porter, vyuldashev and khepin and removed request for vyuldashev March 11, 2023 21:22
@adm-bome adm-bome changed the title Fix/refactor creation of connections and queues Fix/refactor creation of RabbitMQ Connection and QueueAPI Mar 13, 2023
  - Connection disconnected by default (Lazy)
  - refactored publish methods
  - Connection disconnected by default (Lazy)
Copy link
Collaborator

@khepin khepin left a comment

Choose a reason for hiding this comment

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

I think the main structure is good.

The only thing I think should be updated is the use of final and private.

As it stands today this package uses the private keyword only once and never ever uses final. If memory serves well, a couple years ago, the opposite was true. I think it better to keep the same approach here.

src/Queue/Connection/ConfigFactory.php Outdated Show resolved Hide resolved
 - removed `final`
 - changed `private` to `protected`
@adm-bome adm-bome requested a review from khepin March 16, 2023 11:06
 - style testing
 - style fixing
Copy link
Collaborator

@mattgrande mattgrande left a comment

Choose a reason for hiding this comment

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

Nice work on those factories; this is a huge improvement.

I've added a couple minor grammatical changes to the README, but other than that, this looks great.

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
src/Contracts/RabbitMQQueueContract.php Show resolved Hide resolved
adm-bome and others added 4 commits March 17, 2023 17:18
 - Prior to PHP 8.0 constant() returned null and an E_WARNING, so default could be set easily. Sinds PHP 8.0 an ERROR exception is thrown.
 - added a defined() check.
 - added null values in testing config
 - testing defaults
 - testing logic
Co-authored-by: Matt Grande <[email protected]>
Co-authored-by: Matt Grande <[email protected]>
@adm-bome adm-bome requested a review from mattgrande March 17, 2023 16:53
Copy link
Collaborator

@M-Porter M-Porter left a comment

Choose a reason for hiding this comment

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

This is great to see! I started working on a branch with factories but this is much better than any of the code I had.

Thank you for working on this!

README.md Outdated Show resolved Hide resolved
@adm-bome
Copy link
Collaborator Author

@khepin @mattgrande @M-Porter

Could you guys, please have a new look at this PR.
I added some more minor changes / fixes.

If all is ok and tested, this can be merged. [version: v13.3.0]
@M-Porter can you make the neccesarry updates in the CHANGELOG when released?

adm-bome added a commit that referenced this pull request Mar 28, 2023
 - issue #460
 - rework based on [comment](#531 (comment))
@adm-bome adm-bome requested a review from M-Porter March 28, 2023 16:01
@khepin
Copy link
Collaborator

khepin commented Apr 10, 2023

Thanks @adm-bome this is great

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.

4 participants