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

Different Bus Provider not working #334

Closed
mikefrancis opened this Issue Jan 20, 2016 · 6 comments

Comments

Projects
None yet
2 participants
@mikefrancis
Copy link

commented Jan 20, 2016

Trying to use a different Bus provider for my application by doing the following, as described in the docs:

bootstrap/app.php

<?php

// ...

$app->register(App\Providers\AppServiceProvider::class);
$app->register(App\Providers\BusServiceProvider::class);

app/Providers/BusServiceProvider.php

<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;

class BusServiceProvider extends ServiceProvider
{
    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        $this->app->bind(\Illuminate\Contracts\Bus\Dispatcher::class, function ($app) {
            return new \AltThree\Bus\Dispatcher($app);
        });
    }
}

But whenever I try to call any methods on AltThree\Bus\Dispatcher, they don't exist, suggesting that the bind failed.

@GrahamCampbell

This comment has been minimized.

Copy link
Member

commented Jan 20, 2016

This isn't a bug in lumen.

@GrahamCampbell

This comment has been minimized.

Copy link
Member

commented Jan 20, 2016

You can';t just setup a binding like that. You MUST remove the other bus service provider and use alt-three's.

@mikefrancis

This comment has been minimized.

Copy link
Author

commented Jan 20, 2016

@GrahamCampbell Ok, how would you go about doing that then? The only reference I can find to the set up of an original bus service provider is in Application (link)

@GrahamCampbell

This comment has been minimized.

Copy link
Member

commented Jan 20, 2016

You'll have to extend the application file and rebind it. Lumen isn't really built for this sort of thing.

@mikefrancis

This comment has been minimized.

Copy link
Author

commented Jan 20, 2016

Ok, forgive me for being subjective, but I'm sure you can appreciate this seems a little contrived - especially when since 5.2 we can't use dispatchFrom or dispatchFromArray, but fair enough - thanks for the solution.

When you say, "Lumen isn't really built for this sort of thing." - why? Apologies if I'm missing something but it seems like a legitimate thing to swap out.

@GrahamCampbell

This comment has been minimized.

Copy link
Member

commented Jan 20, 2016

Yes it is, but it's not going to be "easy" like in laravel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.