title: How to run multiple threads in ColdFusion
body: <p>I am trying to run 3 threads of an http request in ColdFusion. This is an email system which will select 3 different campaigns and send there respective recipients at the same time.</p>
  
  <p>But my following code only runs one thread and then drops off.</p>
  
  <pre><code>   &lt;cfscript&gt;
          newsLetterCampaignGateway = createObject("component", "legacy.ssl.admin.news.model.newsLetterCampaignGateway");
          newsLetterList = newsLetterCampaignGateway.getNewsLettersDueForSend();
          //writedump(newsLetterList);abort;
  
      &lt;/cfscript&gt; 
  
    &lt;cfloop query="newsLetterList" &gt;
      &lt;cfset newsLetterId =  newsLetterList.newsletterid&gt;
      &lt;cfset campId =  newsLetterList.id&gt;
      &lt;cfset fromEmail =  newsLetterList.fromEmail&gt;
  
      &lt;!--- &lt;cfdump var="#campId#"&gt; ---&gt;
      &lt;cfthread action="run" name="runCampaign#campId#" &gt;
          &lt;cflock
              name="runCampaign_#campId#_Lock"
              type="exclusive"
              timeout="60"&gt;
              &lt;!--- &lt;cfdump var="#campId#"&gt; ---&gt;
              &lt;cfscript&gt;      
                  httpService = new http(); 
                  httpService.setMethod("get"); 
                  httpService.setCharset("utf-8"); 
                  httpService.setUrl("http://mysamplesite.com/legacy/ssl/admin/news/model/newsLettercampaign.cfc"); 
                  httpService.addParam(type="url",name="method",value="sendCampaignNewsLetters"); 
                  httpService.addParam(type="url",name="live",value="true"); 
                  httpService.addParam(type="url",name="campaignId",value="#campId#"); 
                  httpService.addParam(type="url",name="newsLetterId",value="#newsLetterId#"); 
                  httpService.addParam(type="url",name="fromEmail",value="#fromemail#"); 
                  httpService.send();
              &lt;/cfscript&gt; 
          &lt;/cflock&gt;
      &lt;/cfthread&gt;
  
    &lt;/cfloop&gt;
  
  
      &lt;cfloop query="newsLetterList" &gt;
  
              &lt;cfthread
              action="join"
              name="runCampaign#campId#"
              /&gt;
      &lt;/cfloop&gt;
  </code></pre>
  
  <p>Any idea guys?</p>