<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Zechariah Campbell on Medium]]></title>
        <description><![CDATA[Stories by Zechariah Campbell on Medium]]></description>
        <link>https://medium.com/@zechdc?source=rss-8b92d5b6f3ab------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*iPIwLEfsiUMbBUrxc--Trw.png</url>
            <title>Stories by Zechariah Campbell on Medium</title>
            <link>https://medium.com/@zechdc?source=rss-8b92d5b6f3ab------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 13:18:35 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@zechdc/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Setup Textable.io with Twilio Functions and Twilio Studio]]></title>
            <link>https://medium.com/@zechdc/setup-textable-io-with-twilio-functions-and-twilio-studio-218689a3ac7a?source=rss-8b92d5b6f3ab------2</link>
            <guid isPermaLink="false">https://medium.com/p/218689a3ac7a</guid>
            <category><![CDATA[business-phone-systems]]></category>
            <category><![CDATA[twilio-integration]]></category>
            <category><![CDATA[text-messaging]]></category>
            <category><![CDATA[textable]]></category>
            <category><![CDATA[twilio]]></category>
            <dc:creator><![CDATA[Zechariah Campbell]]></dc:creator>
            <pubDate>Sun, 25 Jul 2021 15:26:24 GMT</pubDate>
            <atom:updated>2021-07-26T19:37:24.650Z</atom:updated>
            <cc:license>http://creativecommons.org/licenses/by/4.0/</cc:license>
            <content:encoded><![CDATA[<h3>Setup Textable.co with Twilio Functions and Twilio Studio</h3><p>Textable.co is a web/mobile app for sending text messages using a number of third party SMS providers, including Twilio.</p><p>The problem is, Textable<a href="https://www.textable.co/docs/twilio-setup-guide/">’s setup guide for Twilio</a> is pretty limiting considering all the cool things you can do with Twilio‘s Studio and Functions.</p><p>Textable requires you setup the phone number to send all sms to <a href="https://inbound.textable.app/receive?provider=twilio">https://inbound.textable.app/receive?provider=twilio</a> which doesn’t allow you to easily do things like ‘Send a notification to Slack’ or use Twilio’s Studio which has all kinds of click and drag functionality for building a phone system.</p><p>In order to get around that, we can use Twilio Functions to mimic the Textable setup guide, then do whatever we want with the SMS after that.</p><h3><strong>What does the code do?</strong></h3><ol><li>Forwards the incoming text message to Textable (<a href="https://www.textable.co/docs/twilio-setup-guide/">this mimics the Textable setup guide</a>)</li><li>Posts a notification to Slack</li><li>Do whatever else you want to do with the text using Twilio Studio/Functions.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9uVcFhs7ix9NWQN8TPn8ZQ.png" /></figure><h3><strong>How do I set it up?</strong></h3><h4>1 — Setup Twilio to Textable.co</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_bNpUYSNYnC8O-HpOIACmw.png" /></figure><p><strong>Copy/Paste this code into your new Twilio Function:</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cddacea24733fb2b6667ebae386c1cf9/href">https://medium.com/media/cddacea24733fb2b6667ebae386c1cf9/href</a></iframe><p><strong>Make sure you setup your dependencies correctly</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*I2X9Fg621V5BPIL13JZt0Q.png" /></figure><p><strong>Navigate to your phone numbers in Twilio and point a number to your new function.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/949/1*W_2xsPDxnNSP-sd5LXA00g.png" /></figure><p>Notice the Primary Handler Fails is just pointing directly to Textable. You can do whatever you like here but my preference is to make sure the sms gets to Textable if my function fails.</p><p><strong>DONE! Sorta. This will start sending all incoming messages to Textable and should have the same result as follow Textable’s setup guide: </strong><a href="https://www.textable.co/docs/twilio-setup-guide/">https://www.textable.co/docs/twilio-setup-guide/</a></p><p><em>One caveat:</em> The function will likely fail because postToSlack is missing a URL and this will cause the function to fail. So let’s set that up now! Or you can just delete the postToSlack function call.</p><h3>2 — Setup Slack</h3><ol><li>Create a new app at <a href="https://api.slack.com/apps">https://api.slack.com/apps</a> (Call it what you want, I called mine <em>SMS Notification from Twilio</em> and added the Twilio icon)</li><li>Follow this slack guide for how to create an incoming webhook with your new app. <a href="https://api.slack.com/messaging/webhooks">https://api.slack.com/messaging/webhooks</a></li><li>Now that you have a webhook URL, go update your Twilio function. Replace <strong>YOUR_SLACK_WEBHOOK_URL</strong> with the URL from slack.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9uVcFhs7ix9NWQN8TPn8ZQ.png" /></figure><p><strong>DONE! for real this time. Now you can customize all you want!</strong></p><p>You can use slacks <a href="https://app.slack.com/block-kit-builder/">block kit to change the notification format</a>, you can use Twilio Studio to build visual workflows, you can use Twilio Functions to program if that’s your thing. Have fun!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=218689a3ac7a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deep Dive into Laravel Horizon — what goes on behind the scenes]]></title>
            <link>https://medium.com/@zechdc/laravel-horizon-number-of-workers-and-job-execution-order-21b9dbec72d7?source=rss-8b92d5b6f3ab------2</link>
            <guid isPermaLink="false">https://medium.com/p/21b9dbec72d7</guid>
            <category><![CDATA[laravel-5]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[task-queues]]></category>
            <category><![CDATA[laravel-queue]]></category>
            <category><![CDATA[laravel]]></category>
            <dc:creator><![CDATA[Zechariah Campbell]]></dc:creator>
            <pubDate>Sun, 04 Feb 2018 05:50:30 GMT</pubDate>
            <atom:updated>2018-02-12T03:25:10.851Z</atom:updated>
            <content:encoded><![CDATA[<h3>Deep Dive into Laravel Horizon — what goes on behind the scenes</h3><p>Laravel Horizon is a simple way to get started with Laravel Queues by reducing the amount of configuration to spawn and manage queue workers. However, understanding how the queue worker processes are created and in what order jobs get processed can be a little unclear when starting out, especially if you are new to Queues altogether.</p><p>In this article I will dive into and explain:</p><ul><li>How many worker processes are being spawned by Laravel Horizon?</li><li>If I have more than one queue, such as a high and default queue<br>— how many worker processes are created by Laravel Horizon?<br> — what order are jobs executed?</li></ul><p>Horizon has an option called balance which accepts false , simple , or auto. The balance option directly affects worker creation and job execution.</p><p>Let’s start with the easiest option first, balance=false</p><h3>balance=false</h3><p><a href="https://laravel.com/docs/5.6/horizon#configuration">Documentation says:</a></p><blockquote>When the <em>balance</em> option is set to <em>false</em>, the default Laravel behavior will be used, which processes queues in the order they are listed in your configuration.</blockquote><p><strong>In the case of </strong><strong>balance=false here is how worker processes are created:</strong></p><ol><li>Create worker processes equal to the number you have set processes to in config/horizon.php</li></ol><p><strong>Job execution order:</strong></p><ul><li>The workers will always process jobs in the order of how you define the queues in config/horizon.php .</li></ul><p>Examples? Ya, that might help</p><pre>// config/horizon.php<br>...<br>    <strong>&#39;local&#39; </strong>=&gt; [<br>        <strong>&#39;supervisor-1&#39; </strong>=&gt; [<br>            <strong>&#39;connection&#39; </strong>=&gt; <strong>&#39;redis&#39;</strong>,<br>            <strong>&#39;queue&#39; </strong>=&gt; [<strong>&#39;high&#39;</strong>, <strong>&#39;default&#39;</strong>],<br>            <strong>&#39;balance&#39; </strong>=&gt; <strong>&#39;false&#39;</strong>,<br>            <strong>&#39;processes&#39; </strong>=&gt; 1,<br>            <strong>&#39;tries&#39; </strong>=&gt; 0<br>          ,<br>        ],<br>    ],<br>...</pre><p>With the above config, notice we have two queues specified (high, default)</p><p>We also have balance=false and processes=1</p><p>To get a better understanding of what processes are being created we can login to our Homestead server</p><ol><li>Login to Homestead with homestead ssh . This only works if you are using homestead AND you <a href="https://laravel.com/docs/5.6/homestead#daily-usage">setup this function</a>.</li><li>Once you are in the server, you can run top to view a list of all processes.</li></ol><p>In the image below, each line is a process on the server. I cut out a bunch of useless information like the PID. Here you just see the command that Horizon is running. If you are curious how I got this information, <a href="https://medium.com/@zechdc/laravel-horizon-tinkering-with-balance-config-and-process-creation-cd34a429a07d">Check out my other post.</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bhJBzHMyWrMpheBU21_72g.png" /><figcaption>balance=false AND processes=1</figcaption></figure><p>artisan horizon:superviso is the process responsible for managing the worker processes.</p><p>artisan horizon:work is our actual worker process created by supervisor.</p><p>Notice the supervisor has a param of --max-processes=1 and --min-processes=1 The min-processes will become more important with the other strategies we will talk about later.</p><p>And notice the horizon:work process has a param of --queue=high,default This means it will process ALL high jobs first, then default ones. This will also change in the other strategies.</p><p><strong>What happens when I have a few jobs in both queues? What order are they processed?</strong></p><p>I have a small script that creates some simple test jobs for both queues just to demonstrate the order jobs are being processed. Let’s take a look!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2_GIF3nsi3ow018bPmCF1g.png" /><figcaption>balance=false AND processes=1 while adding jobs to see what order they are processed.</figcaption></figure><ol><li>I added some jobs to the queue — 5 default z:1, z:2, z:3, z:4, z:5 <br>— 1 high high1</li><li>The queue starts by processing a high priority job (high1) then a default job ( z:1)</li><li>When the worker starts started processing z:2, I manually created 5 more default jobs and 1 more high job.</li><li>The worker finished processing z:2 then started on the high2 job.</li></ol><p>Keep in mind, I only have one worker process in this example. If I have 2 or more workers, you would see multiple jobs starting at the same time.</p><h3>balance = simple</h3><p><a href="https://laravel.com/docs/5.6/horizon#configuration">Documentation says:</a></p><blockquote>The <em>simple</em> strategy […] splits incoming jobs evenly between processes.</blockquote><p>In the case of balance=simple here is how worker processes are created:</p><ol><li>Always create 1 worker process for each queue, even if you specify fewer processes than queues in your config.</li><li>If there are any left over processes, create 1 new process for each queue in the order of how the queues are specified in the config.</li></ol><p><em>For example:</em></p><pre><strong>&#39;queue&#39; </strong>=&gt; [<strong>&#39;high&#39;</strong>, <strong>&#39;default&#39;</strong>],<br><strong>&#39;balance&#39; </strong>=&gt; <strong>&#39;simple&#39;</strong>,<br><strong>&#39;processes&#39; </strong>=&gt; 1,</pre><p>will result in 2 processes, NOT 1 process. 1 process is created for each queue in the queue config.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ppxngrz3mDFjB0Tv9uNOgw.png" /><figcaption>balance=simple AND processes=1</figcaption></figure><p><em>And this:</em></p><pre><strong>&#39;queue&#39; </strong>=&gt; [<strong>&#39;high&#39;</strong>, <strong>&#39;default&#39;, &#39;emails&#39;</strong>],<br><strong>&#39;balance&#39; </strong>=&gt; <strong>&#39;simple&#39;</strong>,<br><strong>&#39;processes&#39; </strong>=&gt; 5,</pre><p>will result in 5 total.</p><ul><li>2 for high</li><li>2 for default</li><li>1 for emails</li></ul><p>Why does this matter? Imagine you want your works to process everything in the high priority queue first before moving onto the default queue. If that is the case, stick to balance=false</p><h3>balance = auto</h3><p><a href="https://laravel.com/docs/5.6/horizon#configuration">Documentation says:</a></p><blockquote>The <em>auto</em> strategy adjusts the number of worker processes per queue based on the current workload of the queue. For example, if your <em>notifications</em> queue has 1,000 waiting jobs while your <em>render</em> queue is empty, Horizon will allocate more workers to your <em>notifications</em> queue until it is empty.</blockquote><p>In the case of balance=auto here is how worker processes are created:</p><ol><li>Always create 1 worker process for each queue, even if you specify fewer processes than queues in your config.</li><li>If there are any left over processes, create 1 new process for each queue in the order of how the queues are specified in the config.</li><li>The worker processes are then reassigned to different queues based on which one has jobs in the queue. There will still always be at least 1 process per queue.</li></ol><p><em>For example:</em></p><pre><strong>&#39;queue&#39; </strong>=&gt; [<strong>&#39;high&#39;</strong>, <strong>&#39;default&#39;</strong>],<br><strong>&#39;balance&#39; </strong>=&gt; <strong>&#39;auto&#39;</strong>,<br><strong>&#39;processes&#39; </strong>=&gt; 1,</pre><p>will result in 2 processes, NOT 1 process. 1 process is created for each queue in the queue config.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YkQtV8tkrwOD_dSUx7YS2w.png" /><figcaption>balance=auto AND processes=1</figcaption></figure><p><em>And this:</em></p><pre><strong>&#39;queue&#39; </strong>=&gt; [<strong>&#39;high&#39;</strong>, <strong>&#39;default&#39;, &#39;emails&#39;</strong>],<br><strong>&#39;balance&#39; </strong>=&gt; <strong>&#39;auto&#39;</strong>,<br><strong>&#39;processes&#39; </strong>=&gt; 5,</pre><p>will result in 5 total.</p><ul><li>2 for high</li><li>2 for default</li><li>1 for emails</li></ul><p>However, 2 of the workers will be reassigned to whichever queue has the most jobs. For example, if the emailsqueue has 1,000 jobs, the high queue has 0 jobs, and the defaultqueue has 10 jobs, Horizon you will probably reassign the workers like so:</p><ul><li>1 for high</li><li>1 for default</li><li>3 for emails</li></ul><p>Notice the high priority queue still has 1 worker even though there are 0 jobs for that queue.</p><p><em>Here is another example: </em>Let’s have 2 queues and 6 processes. We add 1,000 jobs to the default queue, then after a minute, add 1,000 high priority jobs and see how Horizon reassigns workers to queues with more jobs.</p><pre><strong>&#39;queue&#39; </strong>=&gt; [<strong>&#39;high&#39;</strong>, <strong>&#39;default&#39;</strong>],<br><strong>&#39;balance&#39; </strong>=&gt; <strong>&#39;auto&#39;</strong>,<br><strong>&#39;processes&#39; </strong>=&gt; 6,</pre><p>After adding 1,000 default jobs:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NMpxDE0F59aLHCF35ZelVQ.png" /><figcaption>balance=auto AND processes=6 AND added 1,000 default priority jobs while there is only 1 high priority job</figcaption></figure><p>After adding 1,000 high jobs while there are still 980 default jobs:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*heTQ9d6llp9CWGrFh4IGfw.png" /><figcaption>balance=auto AND processes=6 AND added 1,000 high priority jobs while there are about 980 default priority jobs</figcaption></figure><p><em>Note: </em>The balance=auto feature won’t do any automatic switching unless you have excess processes . If you have 10 queues and processes set to 11, 1 worker process will be able to move around freely between queues.</p><p><em>In both </em><em>simple and </em><em>auto: </em>If you setup 10 queues and set your processes to 1, you will actually have 10 processes running. Even if you set your processes to 9, you will still have 10 running, 1 for each queue.</p><p>If you are curious how I came to these conclusions, <a href="https://medium.com/@zechdc/laravel-horizon-tinkering-with-balance-config-and-process-creation-cd34a429a07d">check out my other post which is random notes about me testing each case.</a></p><h3>Can I change min-processes?</h3><p>If you are like me, you might be thinking, min-processes is just a config option on the horizon command. Can’t I change that and alter how Horizon spawns my workers. In your config/horizon.php, you can add this to the config:</p><pre><strong>&#39;min-processes&#39; =&gt; 0</strong></pre><p>Or this:</p><pre><strong>&#39;min-processes&#39; </strong>=&gt; <strong>&#39;5&#39;</strong>,</pre><p>The horizon command does get updated to use this config, however, it seems to have zero effect on how processes are spawned.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=21b9dbec72d7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>