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


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="silverdr" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/silverdr/120/23771_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  silverdr
                    <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><a class="mention" href="/u/lostkobrakai" rel="nofollow">@LostKobrakai</a> - thank you for your clear explanations.</p>
<aside class="quote no-group" data-username="LostKobrakai" data-post="21" data-topic="30247">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/lostkobrakai/48/3072_2.png" class="avatar"> LostKobrakai:</div>
<blockquote>
<p>I’m not sure what MTA means</p>
</blockquote>
</aside>
<p>It’s Mail Transport Agent. In the case I mentioned it’s local <code>sendmail</code> (alternative). It has its own persistent queue, work schedule, failure notification, etc.). If that’s not available or an external mail dispatch service is to be employed, I’ve also been using other persistent queue/deferred job implementations,  Sidekiq as an example.</p>
<aside class="quote no-group" data-username="LostKobrakai" data-post="21" data-topic="30247">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/lostkobrakai/48/3072_2.png" class="avatar"> LostKobrakai:</div>
<blockquote>
<p>It’s still the same issues as without the persistent queue, but it’s separated from saving the user (doesn’t affect more code than it needs) and you’ll get a proper history of how many retrys you had, what the error(s) were and you can e.g. be notified if you need to manually resolve something. For the proposed problem in the start of this post nobody would even know that a mail wasn’t sent.</p>
</blockquote>
</aside>
<p>Just to make sure - the way I mentioned does have persistent queue and does notify once it gives up trying (email bounces to appropriate address and is distributed among those who are supposed to care), it also keeps logs, and all. The main difference as I see it now that in my example a) the responsibility is delegated to the MTA, which is a good thing - less code in the application, and b) it is not really transactional, which is a bad thing as the queue insertion may fail once the record is saved. Yes, I handle the errors but it’s not guaranteed to cover all situations. Which brings me back to where (and why) I started the thread. While putting non-DB operations in a DB transaction block is possible, it has its own problems. From the discussion here I understand that maintaining own queue and using a transactional queue insertion with Oban is the way to go with this kind of problem.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="169759" 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/transactional-user-registration/30247/22">Post #21</a>
	                </div>
	            </div>
              <div id="likers-container-169759" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="169759"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-last-post cat-last-post" title="Last post!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>