title: How to set listener queue name from environment variable?
body: <p>I just noticed that some of my listeners do not use the queue I expected them to use. Our team upgraded from Laravel 5.2 to 5.5 a few weeks back, and I guess this is when the problem started happening. There hasn't been much load on the system, so I only discovered it by accident.</p>
  
  <p>Anyway. I used to set the queue name on the listener through a queue method, like so: </p>
  
  <pre><code>public function queue(QueueManager $handler, $method, $arguments): void
  {
      $handler-&gt;connection()-&gt;push($method, $arguments, Queue::getNotificationQueue());
  }
  </code></pre>
  
  <p>This approach is not working anymore, so a default queue ends up handling the job instead of the expected notification queue. </p>
  
  <p>So I looked at the documentation <a href="https://laravel.com/docs/5.5/events#queued-event-listeners" rel="nofollow noreferrer">https://laravel.com/docs/5.5/events#queued-event-listeners</a>, which states that the name should be set on a queue property on the listener. My problem is that I have the queue name in an environment variable, so I cannot just set it directly as a property, as shown in the documentation and it does not work to set it on the constructor, like so: </p>
  
  <pre><code>protected $queue;
  
  public function __construct()
  {
      $this-&gt;queue = Queue::getNotificationQueue();
  }
  </code></pre>
  
  <p>Does anyone here have an idea of how I can get around this?</p>