Laravel 5.4 MultiSite,每个站点都有队列

My Laravel is setup with a MultiSite Middleware Provider that checks the subdomain of the address and based on this subdomain changes the connection on-the-fly to another database.

e.g.

  Config::set('database.connections.mysql.host', $config['host'] );
  Config::set('database.connections.mysql.database', $config['db_name'] );
  Config::set('database.connections.mysql.username', $config['user']);
  Config::set('database.connections.mysql.password', $config['password']);
  Config::set('database.connections.mysql.prefix', $config['prefix']);
  Config::set('database.connections.mysql.theme', $config['theme']);

  // purge main to prevent issues (and potentially speed up connections??)
  DB::disconnect('main');
  DB::purge();

  DB::reconnect();
  return $next($request);

This all works fantastic, except that I now want to use Laravel Queues with the built-in Database driver (sync actually works fine but blocks the user experience for long report generations).

Except Artisan isn't sure which database to connect to so I'm guessing it connects to the default, which is a kind of supervisor database that stores all the subdomains and corresponding db names etc.

Note none of these databases are setup in my database conf as connections, they're stored in a singular management database as there's quite a lot of them.

I've tried cloning the built-in Queue listener and modifying it to swap to the different site connection as so:

/**
 * Create a new queue listen command.
 *
 * @param  \Illuminate\Queue\Listener  $listener
 * @return void
 */
public function __construct(Listener $listener)
{
    // multisite swap
    $site = MultiSites::where('machine_name', $this->argument('site'));
    MultiSites::changeSite($site->id);

    parent::__construct();
    $this->setOutputHandler($this->listener = $listener);
}

But this fails with

$commandPath argument missing for the Listener class.

Trying a similar database/site swap in the fire() or handle() methods stops the $commandPath error however it simply does nothing, no feedback and doesn't begin to process any jobs from the database.

I'm at a loss how to get this working with a multisite environment, does anyone have any ideas or am I going the wrong way about this?

My ideal scenario would be being able to run a singular Queue command, have supervisor monitor that and it to skip through each database checking. But I am also willing to spawn a queue command per database/site if necessary.