Giter Club home page Giter Club logo

service-bus-symfony-bundle's Introduction

ProophServiceBus (PSB) Symfony bundle

Build Status Coverage Status Gitter

A note about versions

Version 0.4 of the bundle works with prooph/service-bus v6.0 and above.

Use version 0.3 for prooph/service-bus 5.x.

Installation

Installation of this Symfony bundle uses Composer. For Composer documentation, please refer to getcomposer.org.

Run composer require prooph/service-bus-symfony-bundle to install prooph service-bus-symfony-bundle.

See Symfony Proophessor-Do demo application for an example.

Documentation

For the latest online documentation visit http://getprooph.org/.

Documentation is in the doc tree, and can be compiled using bookdown

$ ./vendor/bin/bookdown doc/bookdown.json
$ php -S 0.0.0.0:8080 -t doc/html/

Then browse to http://localhost:8080/

Support

Contribute

Please feel free to fork and extend existing or add new plugins and send a pull request with your changes! To establish a consistent code quality, please provide unit tests for all your changes and may adapt the documentation.

License

Released under the New BSD License.

service-bus-symfony-bundle's People

Contributors

basz avatar bl4ckbon3 avatar codeliner avatar coudenysj avatar enumag avatar gquemener avatar iainmckay avatar lunetics avatar mablae avatar prolic avatar sandrokeil avatar sstok avatar stephpy avatar ufomelkor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

service-bus-symfony-bundle's Issues

ProophServiceBusExtension forces you to use more symfony components then you need.

If command bus is used in test environment ProophServiceBusExtension adds DataCollectorPlugin even if you don't have required components(as StopWatch for example). It is problematic especially when one tries to use symfony flex and build an app with the lowest amount of dependencies as possible.

Should the StopWatch be added as a hard dependency to composer.json? Or do you have better idea how should it be handled?

Segfault when registering command bus

Hello,
I have tried registering your bundle like so:

prooph_service_bus:
    command_buses:
        command_bus: ~

while running my app on a Symfony3 web server with PHP 7.1. This has resulted in segfaults when attemping to use the console commands. The only clue I can give is that it was related to strtolower function and was fixed by changing the configuration to:

prooph_service_bus:
    command_buses:
        app_command_bus: ~ # <- a prefix

Find all places which can / should be debuggable

What do you guys should be good information on the toolbar? Just throw all ideas in here.

So far i would propose one tool bar for each bus : Command, Event and Query bus

Command and Event bus should show all called handlers?

The query bus could additionally implement some interface for debugging for "raw" data (query / response using symfony vardumper)

Guard support

The service-bus has two plugins to support authorization, the RouteGuard and the FinalizeGuard.
Both rely on a simple interface AuthorizationService.

Any thoughts about …

  • … adding a AuthorizationService adapter for Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface
  • … allowing to enable each guard for each message-bus per configuration
  • … adding an (optional) event listener to convert Prooph\ServiceBus\Plugin\Guard\UnauthorizedException into Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException if it is not caught in the controller.

BC Break with merged commit 8c5608b

Hey,

the changes in commit 8c5608b, especially the addition in line #110 cause a BC break in our application. It causes the Events thrown by our ProcessManagers to be ignored.

Our ProcessManagers are declared in the following way through tags:

App\ProcessManager\:
   resource: '../src/ProcessManager/*'
   public: true
   tags: [{ name: 'prooph_service_bus.portal_event_bus.route_target', message_detection: true }]

Greetings, Sinan

Use queries without promises as an alternative

Using promises for synchronous code makes my code somewhat dirty, and i've seen in the demo that the alternative exist, but I don't see in the documentation how to use queries without promises

Documentation improvement suggestions

I wanted to give Prooph a try (I have use SimpleBus previously), mainly for the QueryBus support. In trying to set up a test Symfony app, I ran into some problems with the documentation. It took me a while to get everything working, but when I was done, these were the issues I found with the documentation:

As this is my first interaction with the Prooph service bus and this Symfony bundle, I wanted to bring these to the maintainer's attention for review before I went through the hassle of creating a pull request. I don't know if I missed something or possibly didn't understand something and wanted to get feedback first.

1. When using message_detection: true, your commands/events/queries have to implement the Message interface.

This is not explained in the documentation and all of the other Prooph documentation I found describes using Messages or plain PHP objects, or even plain strings. I can see why message_detection would require you to pass objects for determining the message map, but I don't see why they have to implement the Message interface. Either way, this should be called out in the documentation.

2. Handlers/Listeners Service Declaration must be Public

While this is actually called out in the documentation, I missed it originally, and the code examples do not include the public: true in the service declarations. I think this should be added to the examples.

3. Installation instructions do not include installing react/promise

If you create a QueryBus and have not installed react/promise, you get an exception. I am guessing the reason react/promise is not a dependency (and only a dev-dependency) is so it is not installed if the user doesn't generate a QueryBus. There should be some documentation that if you are going to use a QueryBus, you have to manually require react/promise.

Document features

  • Tag handlers/listeners
  • Tag plugins
  • PsrLogger per bus
  • message detection
  • async switch
  • debug bar integration

automatic routing for query bus?

Just wanted to ask if this is supported, as described for the command bus.
Tried to setup the query bus as per command bus analogy, but I cannot make it work

services.yaml

App\Application\QueryHandler\:
        resource: '../src/Application/QueryHandler/*Handler.php'
        tags: [{name: 'prooph_service_bus.default_querybus.route_target', message_detection: true}]

PhpDumper trying to access unknown `Alias::isShared` method during unit test

Test suite does not pass on master.

Here's the execution result:

PHPUnit 6.5.14 by Sebastian Bergmann and contributors.

....E....E..E.......E.......E....E..E.......E.................... 65 / 75 ( 86%)
..........                                                        75 / 75 (100%)

Time: 2 seconds, Memory: 20.00MB

There were 8 errors:

1) ProophTest\Bundle\ServiceBus\DependencyInjection\XmlServiceBusExtensionTest::it_dumps_multiple_command_buses
Error: Call to undefined method Symfony\Component\DependencyInjection\Alias::isShared()

/app/vendor/symfony/dependency-injection/Dumper/PhpDumper.php:1892
/app/vendor/symfony/dependency-injection/Dumper/PhpDumper.php:184
/app/test/DependencyInjection/AbstractServiceBusExtensionTestCase.php:523
/app/test/DependencyInjection/AbstractServiceBusExtensionTestCase.php:110

2) ProophTest\Bundle\ServiceBus\DependencyInjection\XmlServiceBusExtensionTest::it_dumps_multiple_query_buses
Error: Call to undefined method Symfony\Component\DependencyInjection\Alias::isShared()

/app/vendor/symfony/dependency-injection/Dumper/PhpDumper.php:1892
/app/vendor/symfony/dependency-injection/Dumper/PhpDumper.php:184
/app/test/DependencyInjection/AbstractServiceBusExtensionTestCase.php:523
/app/test/DependencyInjection/AbstractServiceBusExtensionTestCase.php:248

3) ProophTest\Bundle\ServiceBus\DependencyInjection\XmlServiceBusExtensionTest::it_dumps_multiple_event_buses
Error: Call to undefined method Symfony\Component\DependencyInjection\Alias::isShared()

/app/vendor/symfony/dependency-injection/Dumper/PhpDumper.php:1892
/app/vendor/symfony/dependency-injection/Dumper/PhpDumper.php:184
/app/test/DependencyInjection/AbstractServiceBusExtensionTestCase.php:523
/app/test/DependencyInjection/AbstractServiceBusExtensionTestCase.php:300

4) ProophTest\Bundle\ServiceBus\DependencyInjection\XmlServiceBusExtensionTest::it_dumps_async_switch_command_bus
Error: Call to undefined method Symfony\Component\DependencyInjection\Alias::isShared()

/app/vendor/symfony/dependency-injection/Dumper/PhpDumper.php:1892
/app/vendor/symfony/dependency-injection/Dumper/PhpDumper.php:184
/app/test/DependencyInjection/AbstractServiceBusExtensionTestCase.php:523
/app/test/DependencyInjection/AbstractServiceBusExtensionTestCase.php:444

5) ProophTest\Bundle\ServiceBus\DependencyInjection\YamlServiceBusExtensionTest::it_dumps_multiple_command_buses
Error: Call to undefined method Symfony\Component\DependencyInjection\Alias::isShared()

/app/vendor/symfony/dependency-injection/Dumper/PhpDumper.php:1892
/app/vendor/symfony/dependency-injection/Dumper/PhpDumper.php:184
/app/test/DependencyInjection/AbstractServiceBusExtensionTestCase.php:523
/app/test/DependencyInjection/AbstractServiceBusExtensionTestCase.php:110

6) ProophTest\Bundle\ServiceBus\DependencyInjection\YamlServiceBusExtensionTest::it_dumps_multiple_query_buses
Error: Call to undefined method Symfony\Component\DependencyInjection\Alias::isShared()

/app/vendor/symfony/dependency-injection/Dumper/PhpDumper.php:1892
/app/vendor/symfony/dependency-injection/Dumper/PhpDumper.php:184
/app/test/DependencyInjection/AbstractServiceBusExtensionTestCase.php:523
/app/test/DependencyInjection/AbstractServiceBusExtensionTestCase.php:248

7) ProophTest\Bundle\ServiceBus\DependencyInjection\YamlServiceBusExtensionTest::it_dumps_multiple_event_buses
Error: Call to undefined method Symfony\Component\DependencyInjection\Alias::isShared()

/app/vendor/symfony/dependency-injection/Dumper/PhpDumper.php:1892
/app/vendor/symfony/dependency-injection/Dumper/PhpDumper.php:184
/app/test/DependencyInjection/AbstractServiceBusExtensionTestCase.php:523
/app/test/DependencyInjection/AbstractServiceBusExtensionTestCase.php:300

8) ProophTest\Bundle\ServiceBus\DependencyInjection\YamlServiceBusExtensionTest::it_dumps_async_switch_command_bus
Error: Call to undefined method Symfony\Component\DependencyInjection\Alias::isShared()

/app/vendor/symfony/dependency-injection/Dumper/PhpDumper.php:1892
/app/vendor/symfony/dependency-injection/Dumper/PhpDumper.php:184
/app/test/DependencyInjection/AbstractServiceBusExtensionTestCase.php:523
/app/test/DependencyInjection/AbstractServiceBusExtensionTestCase.php:444

ERRORS!
Tests: 75, Assertions: 158, Errors: 8.

I'm currently investigating for the cause of this issue.
Any hint is welcome :)

Installation fail with symfony 4 and flex

Composer require logs:

Problem 1
    - Installation request for prooph/service-bus-symfony-bundle ^0.5.1 -> satisfiable by prooph/service-bus-symfony-bundle[v0.5.1].
    - Conclusion: remove symfony/config v4.0.2
    - Conclusion: don't install symfony/config v4.0.2
    - prooph/service-bus-symfony-bundle v0.5.1 requires symfony/config ~3.3 -> satisfiable by symfony/config[v3.3.0, v3.3.1, v3.3.10, v3.3.11, v3.3.12, v3.3.13, v3.3.14, v3.3.2, v3.3.3, v3.3.4, v3.3.5, v3.3.6, v3.3.7, v3.3.8, v3.3.9, v3.4.0, v3.4.1, v3.4.2].

composer.json

"require": {
        "php": "^7.1.3",
        "ext-iconv": "*",
        "api-platform/api-pack": "^1.0",
        "beberlei/assert": "^2.8",
        "ramsey/uuid": "^3.7",
        "symfony/console": "^4.0",
        "symfony/flex": "^1.0",
        "symfony/framework-bundle": "^4.0",
        "symfony/lts": "^4@dev",
        "symfony/yaml": "^4.0"

Symfony 4 Dependencies

Can the Symfony dependencies please be upgraded to include the SF4 releases? Did anybody test if this bundle is compatible yet?

If I have enough time I will try to create a fork to try this bundle out in the next few days, but I can't promise anything.

Add plugin to message bus throw RuntimeException

According to the documentation, we can add plugin using service definition and register it under prooph_service_bus.command_buses.acme_command_bus.plugins.

But it throw RuntimeExceptionProophServiceBusExtension, because ContainerBuilder doesn't have definition when extension load.

Is this intentional, that we can only add plugin from the bundle itself?

Make handlers public by default

I could not recognize a scenario where a private handler is needed. Therefore we could make handlers automatically public.

Call to undefined method toArray

Hello!

After upgrading this bundle from 0.4.1 to 0.5.0, looks like this bundle "forces" to use Commands that extend and implement the whole Prooph\Common\Messaging\Command stuff.

The actual Prooph\ServiceBus\CommandBus doesn't, afaik it can take anything as a command and dispatch it to a registered handler no problem.

I've set up an example repository to demonstrate the problem: https://github.com/robertbasic/prooph-bundle-bug (I've pinned the bundle version number to 0.5.0 so we always get the same version).

It has 2 Symfony console commands:

Broken comand

./bin/console app:run:broken -v --no-ansi

Expected output:

https://robertbasic.com/index.xml

Actual output:


                                                                
  [Prooph\ServiceBus\Exception\CommandDispatchException (422)]  
  Message dispatch failed. See previous exception for details.  
                                                                

Exception trace:
 () at /home/robert/projects/prooph-bundle-bug/vendor/prooph/service-bus/src/Exception/MessageDispatchException.php:26
 Prooph\ServiceBus\Exception\MessageDispatchException::failed() at /home/robert/projects/prooph-bundle-bug/vendor/prooph/service-bus/src/Exception/CommandDispatchException.php:25
 Prooph\ServiceBus\Exception\CommandDispatchException::wrap() at /home/robert/projects/prooph-bundle-bug/vendor/prooph/service-bus/src/CommandBus.php:107
 Prooph\ServiceBus\CommandBus->dispatch() at /home/robert/projects/prooph-bundle-bug/src/AppBundle/Command/RunBroken.php:23
 AppBundle\Command\RunBroken->execute() at /home/robert/projects/prooph-bundle-bug/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:262
 Symfony\Component\Console\Command\Command->run() at /home/robert/projects/prooph-bundle-bug/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:906
 Symfony\Component\Console\Application->doRunCommand() at /home/robert/projects/prooph-bundle-bug/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:224
 Symfony\Component\Console\Application->doRun() at /home/robert/projects/prooph-bundle-bug/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:77
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /home/robert/projects/prooph-bundle-bug/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:125
 Symfony\Component\Console\Application->run() at /home/robert/projects/prooph-bundle-bug/bin/console:27

                                                                         
  [Error]                                                                
  Call to undefined method AppBundle\Domain\Command\FetchUrl::toArray()  
                                                                         

Exception trace:
 () at /home/robert/projects/prooph-bundle-bug/vendor/prooph/service-bus-symfony-bundle/src/Plugin/PsrLoggerPlugin.php:89
 Prooph\Bundle\ServiceBus\Plugin\PsrLoggerPlugin->createContextFromActionEvent() at /home/robert/projects/prooph-bundle-bug/vendor/prooph/service-bus-symfony-bundle/src/Plugin/PsrLoggerPlugin.php:48
 Prooph\Bundle\ServiceBus\Plugin\PsrLoggerPlugin->Prooph\Bundle\ServiceBus\Plugin\{closure}() at /home/robert/projects/prooph-bundle-bug/vendor/prooph/common/src/Event/ProophActionEventEmitter.php:57
 Prooph\Common\Event\ProophActionEventEmitter->dispatch() at /home/robert/projects/prooph-bundle-bug/vendor/prooph/service-bus/src/CommandBus.php:93
 Prooph\ServiceBus\CommandBus->dispatch() at /home/robert/projects/prooph-bundle-bug/src/AppBundle/Command/RunBroken.php:23
 AppBundle\Command\RunBroken->execute() at /home/robert/projects/prooph-bundle-bug/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:262
 Symfony\Component\Console\Command\Command->run() at /home/robert/projects/prooph-bundle-bug/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:906
 Symfony\Component\Console\Application->doRunCommand() at /home/robert/projects/prooph-bundle-bug/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:224
 Symfony\Component\Console\Application->doRun() at /home/robert/projects/prooph-bundle-bug/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:77
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /home/robert/projects/prooph-bundle-bug/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:125
 Symfony\Component\Console\Application->run() at /home/robert/projects/prooph-bundle-bug/bin/console:27

Working comand

$ ./bin/console app:run:working

Output:

https://robertbasic.com/index.xml

Let me know what else do I need to provide, thanks!

Update to phpunit 6

Tests failing with: PHP Fatal error: Class 'PHPUnit_Framework_TestCase' not found in /home/travis/build/prooph/service-bus-symfony-bundle/test/BundleTest.php on line 18

Should be PHPUnit\Framework\TestCase now.

/cc @basz maybe?

Disable DataCollectorPlugin

For some reason the DataCollectorPlugin slows the performance of my import by roughly 100%. According to blackfire.io the plugin greatly increases time used by garbage collector. I don't care why that happens since I don't really need the plugin.

I obviously can't set kernel.debug to false since I want to see errors. And I can't uninstall symfony/stopwatch either since it is required by friendsofphp/php-cs-fixer. So I need some other way to disable this plugin. How can I do that?

Outdated docs

prooph/proophessor-do-symfony#30

But please note issue with examples. Maybe docs update? And video with example seems to be outdated. ALso, message_detection does not work for me. "QueryBus was not able to identify a Finder for query "

Symfony 4 QueryBus was not able to identify a Finder for query "path to query" at /app/vendor/prooph/service-bus/src/QueryBus.php:56

After change version symfony from 3.4 to 4.2 i have problem with implementation queryBus in my project. I get response: QueryBus was not able to identify a Finder for query "path" at /app/vendor/prooph/service-bus/src/QueryBus.php:56. It looks like the query does not see the handler. I tried make it with file config prooph_service_bus.php, but still not work. You could help solve this problem?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.