Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a sendAsync method #13

Open
ggrossetie opened this issue Dec 8, 2014 · 8 comments
Open

Create a sendAsync method #13

ggrossetie opened this issue Dec 8, 2014 · 8 comments

Comments

@ggrossetie
Copy link
Member

When I send an email I don't want to "block" my process. I'm using Akka to "schedule" the send:

Akka.system.scheduler.scheduleOnce(1.seconds) {
}

Maybe we can add a sendAsync to the API to do that ? or just an example in the documentation ?
And it might be better to return a Future ?

@jroper
Copy link
Member

jroper commented Dec 8, 2014

Maybe we could implement a reactive mail client? 😉

@ggrossetie
Copy link
Member Author

or just name the method sendReactive() to give the feeling of reactive 😄

@krispypen
Copy link

👍 for the reactive mail client :)

screenshot from 2015-07-20 16 38 21

@ggrossetie
Copy link
Member Author

@jroper could you explain what you have in mind ? Provide an implementation of http://www.reactive-streams.org/ ? Rely on Akka for async ? Replace commons-mailer with X ?

Thanks :)

@jroper
Copy link
Member

jroper commented Aug 3, 2015

Definitely not provide an implementation of reactive streams. However, we could use Akka streams to implement an asynchronous SMTP client - SMTP is mostly line by line so would be quite simple to parse and implement. But, I was 90% joking - I don't want to maintain an SMTP client.

@ggrossetie
Copy link
Member Author

I was 90% sure you were joking 😄
And what do you think about the initial proposition (i.e. using Akka to schedule the send) ? This is a simple (and maybe dumb solution) but then users can compose futures (using other Play! libraries like WS).

@jroper
Copy link
Member

jroper commented Aug 3, 2015

You could also just do:

Future(...)

That will dispatch it asynchronously, and also allow you to add callbacks when it's done.

@schmitch
Copy link
Contributor

schmitch commented Dec 4, 2015

@jroper even if it sounds aweful but I think maintaining a akka-mail client has benefits.

Also we wouldn't need to provide a SMTP Mailer, we could drop apache-commons Mail and just use javax.mail (which apache-commons uses internally) we would just drop a dependency that only gives a "nicer" API. But that happens only internally so, the benefit is definitely there by dropping yet another dependency. And Akka is mostly there anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants