title: How to dispatch chained jobs to a queue in Lumen 6?
body: <p>In Laravel, it is possible to specify a list of queued jobs that should be run in sequence after the primary job has executed successfully. If one job in the sequence fails, the rest of the jobs will not be run. The Laravel documentation shows that this is accomplished by using the withChain method on a dispatchable job, as in this example:</p>
  
  <pre><code>ProcessPodcast::withChain([
      new OptimizePodcast,
      new ReleasePodcast
  ])-&gt;dispatch();
  </code></pre>
  
  <p>This works well for me in Laravel, however I am using Lumen (a lightweight subset of Laravel).<br>
  According to <a href="https://lumen.laravel.com/docs/6.x/queues" rel="nofollow noreferrer">Lumen's documentation on queues</a>, "Like many other parts of the framework, Lumen's queued jobs function identically to Laravel's queued jobs. So, to learn more about queuing jobs in Lumen, please review the full Laravel queue documentation."</p>
  
  <p>The Lumen docs do mention some minor differences with Laravel, including a difference in the way that jobs are dispatched to a queue.  It explains that jobs in Lumen can be dispatched using either the dispatch function or the Queue facade:</p>
  
  <pre><code>dispatch(new ExampleJob);
  
  Queue::push(new ExampleJob);
  </code></pre>
  
  <p>With that as background, is there any way to dispatch chained jobs in Lumen?  I have scoured Google for days, and the closest matches to my issue are these two links:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/47308381/job-chaining-in-lumen-5-5-withchain-not-working-how-can-i-make-it-work">This Stack Overflow post</a>, which exactly describes my issue but does not offer any solutions</li>
  <li><a href="https://laracasts.com/discuss/channels/lumen/job-chaining-in-lumen-56" rel="nofollow noreferrer">This Laracast thread</a>, which suggests a syntax of <code>$this-&gt;dispatch( (new FillBruteFec($import))-&gt;chain(new FillRaiFec()) );</code> that also doesn't work for me.</li>
  </ul>
  
  <p>The Stack Overflow link above explains that the reason the Laravel syntax won't work is that Lumen is missing the <code>Illuminate\Foundation\Bus\Dispatchable</code> trait.</p>
  
  <p>Further complicating matters is that I need to pass a different set of parameters to each of my jobs - something that is <a href="https://github.com/laravel/framework/issues/21339" rel="nofollow noreferrer">apparently challenging to do even in the full Laravel framework</a>.  </p>
  
  <p>Here is how I am currently submitting my jobs in my Lumen app (without chaining):</p>
  
  <pre><code>Queue::push(new CreateUser($username,$password));
  Queue::push(new SetForwarding($username,$forwardTo));
  Queue::push(new EnableIncomingEmail($username));
  Queue::push(new EnableOutgoingEmail($username));
  Queue::push(new EnableImap($username));
  </code></pre>
  
  <p>The main reason I want to chain these is to make sure the user record gets created successfully before any of the subsequent jobs that modify that user.</p>
  
  <p>So, with all of that in mind... how about it?  Is it at all possible to chain jobs in Lumen?  If so, what syntax would I use?</p>