<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="79666" data-post-id="79666">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="namor" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/namor/120/9598_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  namor
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p><a class="mention" href="/u/samphilipd" rel="nofollow">@samphilipd</a> Could you highlight the differences between  <a href="http://github.com/samphilipd/rihanna" rel="noopener nofollow ugc">Rihanna</a> and <a href="https://github.com/mbuhot/ecto_job" rel="noopener nofollow ugc">EctoJob</a> other than the obvious dependency on Ecto?</p>
<p>Are there huge performance differences?</p>
<p>I’m trying to pick between both of them for my first job queue. (EctoJob has the advantage of changing to other databases.. cassandra etc.)</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="79666" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-best-handle-tasks-when-pulling-from-a-job-queue/13294/23">Post #22</a>
	                </div>
	            </div>
              <div id="likers-container-79666" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="79666"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #22"></div>
  </section>
</div>
    <div class="postbit" id="79673" data-post-id="79673">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="mbuhot" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/mbuhot/120/33444_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  mbuhot
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>EctoJob is very much tied to Postgres.<br>
The main difference in the design is transaction support. From what I can see, Rihanna doesn’t directly support enqueing a job as part of a larger transaction, while ecto_job strongly encourages it.<br>
Same for job completion - both frameworks are at-least-once in the presence of crashes/restarts/etc, but ecto_job allows you to mark the job as completed in the same transaction as your other application updates.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="79673" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-best-handle-tasks-when-pulling-from-a-job-queue/13294/24">Post #23</a>
	                </div>
	            </div>
              <div id="likers-container-79673" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="79673"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #23"></div>
  </section>
</div>
    <div class="postbit" id="79678" data-post-id="79678">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="mbuhot" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/mbuhot/120/33444_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  mbuhot
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Honeydew also recently added Ecto as a backend (<a href="https://github.com/koudelka/honeydew/blob/master/README.md#ecto-poll-queue" class="inline-onebox" rel="noopener nofollow ugc">honeydew/README.md at master · koudelka/honeydew · GitHub</a>), implemented in a DB agnostic way. It will possibly hit scaling issues since it isn’t using the Postgres <code>skip locked</code> mechanism last I checked.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="79678" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-best-handle-tasks-when-pulling-from-a-job-queue/13294/25">Post #24</a>
	                </div>
	            </div>
              <div id="likers-container-79678" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="79678"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #24"></div>
  </section>
</div>
    <div class="postbit" id="79823" data-post-id="79823">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="samphilipd" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/samphilipd/120/5044_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  samphilipd
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group quote-modified" data-username="namor" data-post="23" data-topic="13294" data-full="true">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/namor/48/9598_2.png" class="avatar"> namor:</div>
<blockquote>
<p><a class="mention" href="/u/samphilipd" rel="nofollow">@samphilipd</a> Could you highlight the differences between  Rihanna  and EctoJob  other than the obvious dependency on Ecto?</p>
<p>Are there huge performance differences?</p>
<p>I’m trying to pick between both of them for my first job queue. (EctoJob has the advantage of changing to other databases… cassandra etc.)</p>
</blockquote>
</aside>
<p>As mbuhot has explained they are intended for slightly different use-cases.</p>
<p>Rihanna is meant as a general purpose job queue, where your jobs might have side-effects such as POSTing to an external web service or sending an email.</p>
<p>ecto_job can be used for this but also allows you to execute code within the context of the job transaction, so that jobs are deleted atomically with whatever database changes you make.</p>
<p>Rihanna is lighter weight because it does not hold transactions open for the duration of the job execution. This allows for long-running jobs, high concurrency levels and probably higher throughput than ecto_job.</p>
<p>They aren’t mutually exclusive and there’s no reason you couldn’t use both in a single application if you need the atomic commit features of ecto_job as well as a general purpose job queue.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="79823" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-best-handle-tasks-when-pulling-from-a-job-queue/13294/26">Post #25</a>
	                </div>
	            </div>
              <div id="likers-container-79823" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="79823"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #25"></div>
  </section>
</div>
    <div class="postbit" id="79881" data-post-id="79881">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="namor" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/namor/120/9598_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  namor
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Thanks mbuhot &amp; samphilipd.  I have a much better idea now of what to do next</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="79881" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-best-handle-tasks-when-pulling-from-a-job-queue/13294/27">Post #26</a>
	                </div>
	            </div>
              <div id="likers-container-79881" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="79881"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #26"></div>
  </section>
</div>
    <div class="postbit" id="79884" data-post-id="79884">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="mbuhot" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/mbuhot/120/33444_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  mbuhot
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="samphilipd" data-post="26" data-topic="13294">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/samphilipd/48/5044_2.png" class="avatar"> samphilipd:</div>
<blockquote>
<p>Rihanna is lighter weight because it does not hold transactions open for the duration of the job execution</p>
</blockquote>
</aside>
<p>As I mentioned <a href="https://forum.elixirforum.com/t/how-to-best-handle-tasks-when-pulling-from-a-job-queue/13294/15" rel="nofollow">earlier in this thread</a>, this isn’t true. EctoJob uses <code>Ecto.Multi</code> to accumulate database commands which are finally submitted to the DB in a call to <code>Repo.transaction</code>.</p>
<p>Long running network requests should be made prior to calling <code>Repo.transaction(multi)</code> to ensure the final transaction is not longer than necessary.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="79884" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-best-handle-tasks-when-pulling-from-a-job-queue/13294/28">Post #27</a>
	                </div>
	            </div>
              <div id="likers-container-79884" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="79884"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #27"></div>
  </section>
</div>
    <div class="postbit" id="80130" data-post-id="80130">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="koudelka" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/koudelka/120/16420_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  koudelka
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p><a href="https://github.com/koudelka/honeydew/blob/master/README.md#ecto-poll-queue" rel="noopener nofollow ugc">Honeydew’s Ecto Queue</a> (as of a day or so ago), selects queries based on the database backing the Ecto Repo, in order to use DB-specific features.</p>
<p>The Postgres backend uses <code>FOR UPDATE SKIP LOCKED</code>, while the CockroachDB backend just uses <code>ORDER BY LIMIT 1</code>.</p>
<p>I’m honestly not in love with the idea of using a database as a queue, my primary motivation for writing the Ecto queue for Honeydew was so that I could transactionally enqueue work that needed to occur for every instance of a certain model.</p>
<p>Honeydew’s Ecto queue doesn’t even “enqueue” in the traditional sense, since it stores its state directly in the domain model, with the assumption that the job needs to be run for every instance, there’s no separate “job”.</p>
<p>I’ve been experimenting with a truly distributed and scalable job queue that I wrote with <code>riak_core</code> I’m probably going to release in a later version of Honeydew, and I think I’ll end up feeding it jobs by streaming my domain model’s database, to maintain the semantics of a transactional enqueue without the lock contention from competing workers.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="80130" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-best-handle-tasks-when-pulling-from-a-job-queue/13294/29">Post #28</a>
	                </div>
	            </div>
              <div id="likers-container-80130" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="80130"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #28"></div>
  </section>
</div>
    <div class="postbit" id="98301" data-post-id="98301">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="wlminimal" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  wlminimal
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>How can I get a result from scheduled job from rihanna?</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">Rihanna.schedule(
    {MyApp.Work, :need_to_get_some_result, [arg1, arg2]}, 
    at: DateTime.from_naive!(schedule_datetime, "Etc/UTC")
)
</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="98301" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-best-handle-tasks-when-pulling-from-a-job-queue/13294/30">Post #29</a>
	                </div>
	            </div>
              <div id="likers-container-98301" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="98301"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #29"></div>
  </section>
</div>
    <div class="postbit" id="98384" data-post-id="98384">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="samphilipd" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/samphilipd/120/5044_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  samphilipd
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Hi wlminimal</p>
<p>I’m not sure I understand what you are trying to do. What kind of result are you trying to get?</p>
<p>Since Rihanna is an asynchronous job processing library, it cannot return the result of the executed function. This is by design. If you need the result, why not just execute the function inline?</p>
<p>Regards<br>
Sam</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="98384" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-best-handle-tasks-when-pulling-from-a-job-queue/13294/31">Post #30</a>
	                </div>
	            </div>
              <div id="likers-container-98384" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="98384"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #30"></div>
  </section>
</div>
    <div class="postbit" id="279043" data-post-id="279043">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="macrocreation" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/macrocreation/120/23904_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  macrocreation
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Hi,</p>
<p>Love the ability to just enqueue arbitrary calls and the shipped GUI. Really make this library easy to get up and running.</p>
<p>Have you considered a version that uses <a href="https://github.com/lucaong/cubdb" class="inline-onebox" rel="noopener nofollow ugc">GitHub - lucaong/cubdb: Elixir embedded key/value database · GitHub</a> or sqlite so you can get up and running quickly with no dependency on postgres?</p>
<p>Thanks,<br>
Hafeez</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="279043" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-best-handle-tasks-when-pulling-from-a-job-queue/13294/32">Post #31</a>
	                </div>
	            </div>
              <div id="likers-container-279043" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="279043"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #31"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <a class="load-more-button" data-turbo-stream="true" href="/topics/13294/load_more?page=4">Load more posts (3 remaining)</a>
</div></template></turbo-stream>