thephpleague / tactician-bernard

Tactician integration with the Bernard queueing library
MIT License
19 stars 3 forks source link

Use Producer instead of a Queue #17

Closed sagikazarmark closed 9 years ago

sagikazarmark commented 9 years ago

Based on discussion in #15

sagikazarmark commented 9 years ago

@rosstuck I am willing to merge this one first and anything else afterwards. Meaning if we want to follow Bernard pattern strictly, we have to drop the single command bus thing.

sagikazarmark commented 9 years ago

Possible router registration:

<?php

class RouterSetup
{
    protected $commandBus;

    public function __construct($commandBus)
    {
        $this->commandBus = $commandBus;
    }

    public function registerRouter($router)
    {
        $router->add('League\Tactician\Command', [$this->commandBus, 'handle']);
    }
}
sagikazarmark commented 9 years ago

/cc @rosstuck @henrikbjorn

rosstuck commented 9 years ago

I've gotta run to a client, will get back to you tonight. I need to read the rest of the other thread but I'm not sure this means dropping the single command bus aspect since that really comes down to solving the infinite loop issue. Considering this router still takes a callable, we can still flag/wrap/etc.

At any rate, let me read the other thread and get back to you this evening. :)

sagikazarmark commented 9 years ago

Yeah, actually I realised that there is a far more better way than I am currently trying with the PreventLoopRouter.

sagikazarmark commented 9 years ago

@rosstuck IIRC we agreed on this one, can I merge it?

rosstuck commented 9 years ago

At a high level, yes, though I thought the plan was to remove the Setup class in favor of a Receiver that implemented __invoke()?

rosstuck commented 9 years ago

Ah, disregard, I see that happened in #18, my bad.