Giter Site home page Giter Site logo

Comments (6)

mbadolato avatar mbadolato commented on July 4, 2024

As a temporary workaround, for anyone that needs it, re-defining the service in your application's ownservices.xml file overwrites the broadway definition and seems to work.

<service id="broadway.auditing.command_logger" class="Broadway\Auditing\CommandLogger">
    <argument type="service" id="monolog.logger" />
    <argument type="service" id="broadway.auditing.serializer" />
    <tag name="broadway.event_listener" event="broadway.command_handling.command_success" method="onCommandHandlingSuccess" />
    <tag name="broadway.event_listener" event="broadway.command_handling.command_failure" method="onCommandHandlingFailure" />
</service>

Though I don't know that there are guarantees that that's always a the case or if it just depends on the order in which Symfony manages to rebuild the service container (i,e., I don't know if there's a defined processing order or if it's possible that your services.xml could be parsed first then overwritten by the Broadway definition).

from broadway.

wjzijderveld avatar wjzijderveld commented on July 4, 2024

Actually, it is dynamically injected: https://github.com/qandidate-labs/broadway/blob/master/src/Broadway/Bundle/BroadwayBundle/DependencyInjection/BroadwayExtension.php#L46-L59
So with logger: false, it should fallback to simple_command_bus.

I agree that you will end up with a non-working (and by default non-used) service with logging disabled, so we might need to remove that service in the else.

from broadway.

mbadolato avatar mbadolato commented on July 4, 2024

Ah, didn't dig down and see that it was dynamically created. Not so worried about it being non-used, however I did have logger set to false and it caused Symfony to hork. When I get some time this weekend, I'll see if I can dig further

from broadway.

mbadolato avatar mbadolato commented on July 4, 2024

Setting logger: true yields:

The service "broadway.auditing.command_logger" has a dependency on a non-existent service "1".

Edit: I'm guessing it needs an actual class/service instead of just true

Setting logger:false yields:

Catchable Fatal Error: Argument 1 passed to Broadway\Auditing\CommandLogger::__construct() must implement interface Psr\Log\LoggerInterface, string given, called in /Users/mbadolato/development/projects/example-symfony-ddd/var/cache/dev/appDevDebugProjectContainer.php on line 1078 and defined

config:

broadway:
    command_handling:
        logger: false

    read_model:
        repository: elasticsearch
        elasticsearch:
            hosts:
                - localhost:9200

    saga:
        repository: in_memory

from broadway.

mbadolato avatar mbadolato commented on July 4, 2024

ok, so logger: false doesn't work for me, but using the name of the monolog logger service ('logger') works. Was giving me fits; I had mistakenly tried to set it with the service "@logger" 😄

broadway:
    command_handling:
        logger: logger

from broadway.

wjzijderveld avatar wjzijderveld commented on July 4, 2024

Yes, it uses the value (when not falsey) as a direct reference, so no '@' required. As we use XML the @ probably wouldn't have worked in any situation :-)

We use this configuration in our application:

broadway:
    command_handling:
        logger: monolog.logger.commandlog

I agree this isn't the prettiest solution, but mainly a matter of missing documentation. Closing this for now.

from broadway.

Related Issues (20)

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.