Giter VIP home page Giter VIP logo

Comments (5)

princemaple avatar princemaple commented on June 26, 2024

Hi Maxcell,

Concurrency is so very first class in Elixir and it is as easy as Task.start(MyEmailModule, :send_welcome_email, [arg1, arg2]) to asynchronously send an email. Many libs of different uses provide their async strategy, which can be useful, but it can often be very repetitive and useless to have a built in way of "doing it asynchronously" in Elixir libs if you already have developed a universal / business-specific way of doing it. That is my thought. I'm not sure if @stevedomin ever thought about adding a builtin approach to it.

Additionally, email-sending functionality can be very business logic oriented. Do you want to retry? How do you want to handle async errors? Those are the questions that you may get different answers from different users of the lib. It's hard to satisfy every user.

Po

from swoosh.

stevedomin avatar stevedomin commented on June 26, 2024

hello @maxcell, very good question!

As @princemaple said it would be very easy to start using Task to send emails in your project. The reason why this convenience was deliberately not added to this project is that I want users to make the decision about the tradeoffs involved with doing it this way.

Many people coming to Elixir, Phoenix and presumably Swoosh come from the Rails world and the deliver_later function has a special semantic attached to it, it usually means that the email delivery will be done using ActiveJob to provide asynchronous execution. That also means you can easily see if it has failed, it can be retried, etc.

It wouldn't be the case with Task, or at least not with a naive Task implementation, and that's why I've been reluctant to add it to Swoosh.

However it would probably be worth adding a section to the README and the docs explaining this reasoning.

I'm also very open to revisiting this question, at least maybe we can add a Behaviour that would have to be implemented by various backends to provide the deliver_later functionality. What do you think?

from swoosh.

princemaple avatar princemaple commented on June 26, 2024

Now we have a section in README about async! https://github.com/swoosh/swoosh#async-emails

from swoosh.

maxcell avatar maxcell commented on June 26, 2024

Thank you by the way @princemaple ❤️ I really do appreciate this a lot.

from swoosh.

princemaple avatar princemaple commented on June 26, 2024

@maxcell not a problem at all :)

from swoosh.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.