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

Doctrine provider #110

Merged
merged 32 commits into from
Mar 28, 2018
Merged

Doctrine provider #110

merged 32 commits into from
Mar 28, 2018

Conversation

talisman-innovations
Copy link

Hi

As discussed a while ago here's an implementation of a Doctrine provider for qpush. The idea is to have a table 'uecode_qpush_message' that holds all the messages for all the queues for the provider. Each message has a queue_name and a boolean to mark it as delivered or not. The message gets serialised by doctrine and then stored/retrieved from the table. Messages are not deleted from the table apart from when the destroy method is called. So the message table has a history of all the message sent along with created and updated times.

To use - examples

config.yml

uecode_qpush:

providers:
    doctrine_provider:
        driver: doctrine  
queues:
    modified_products:
        provider: doctrine_provider

You can optionally pass in an entity manager for doctrine. Otherwise it defaults to doctrine.orm.default_entity_manager

entity_manager: my.entity.manager

Add this to composer.json

    "doctrine/orm":           "^2.4.8",
    "stof/doctrine-extensions-bundle": "^1.2"

To create the table use console doctrine:schema:update

Other than that usage is as per the other providers.

This was referenced Aug 22, 2016
if (!$this->repository) {
return;
}
return $this->repository;
Copy link
Contributor

Choose a reason for hiding this comment

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

Line break before the return statement

@k-k
Copy link
Contributor

k-k commented Sep 8, 2016

Hey @talisman-innovations! I added a couple minor CS type comments, otherwise, this is looking pretty good.

@talisman-innovations
Copy link
Author

Hi @kmfk - no problem - I think I got them all, plus added an implementation of the create function for good measure. Regards Steve

@talisman-innovations
Copy link
Author

For a use case we have I'm thinking of implementing a function to allow for redelivery of a message. As the messages sit in the DB it's trivial to implement. Any issues with adding that?

Tt could go in the AbstractProvider if other providers offer that feature.
Any thoughts on naming - maybe republish(id)?

@scrutinizer-notifier
Copy link

The inspection completed: 5 new issues, 31 updated code elements

@k-k
Copy link
Contributor

k-k commented Oct 9, 2017

@talisman-innovations I have no memory of why this would still be open for so long. Looking it over, this looks good to me, but wanted to confirm with you before merging.

@talisman-innovations
Copy link
Author

Hi - yes feel free to merge. Thanks.

@k-k
Copy link
Contributor

k-k commented Oct 10, 2017

Will do. Currently need to fix an issue with PHPUnit and Symfony ^3.2 to fix the failing builds. Will get this in afterward.

@k-k k-k merged commit 2f0fafc into uecode:master Mar 28, 2018
@drzraf
Copy link

drzraf commented Dec 18, 2018

This provider is not documented.
In production environment, even if this provider is NOT used, cache:clear triggers:

In AnnotationException.php line 54:
  [Semantical Error] The annotation "@Gedmo\Mapping\Annotation\Timestampable" in property Uecode\Bundle\QPushBundle\Entity\DoctrineMessage::$created does not exist, or could not be auto-loaded.  

unless stof/doctrine-extensions-bundle is installed.

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.

None yet

6 participants