Now that we have our queue worker that deletes teams (for all it knows, the teams don't even have to be without any players), we can explore how we can process this queue ourselves if we don't want the cron option. If we wanted it to be processed using a Drush command, we would not have to write that ourselves. Drush comes with one, and it would work like this:
drush queue-run team_cleaner
However, we may want to create an admin interface, a form of some kind, which allows the user to trigger the queue processing. In that case, we could do something like this:
$queue = \Drupal::queue('team_cleaner'); /** @var QueueWorkerInterface $queue_worker */ $queue_worker = \Drupal::service('plugin.manager.queue_worker')->createInstance('team_cleaner'); ...