Skip to content

Project for playing with some functions from the Task module. It simulates an email sending service

Notifications You must be signed in to change notification settings

hudsonbay/sender

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sender

This is a little project for playing with some functions from the Task module. It simulates an email sending service.

This is the result of following the book Concurrent Data Processing in Elixir Fast, Resilient Applications with OTP, GenStage, Flow, and Broadway by Svilen Gospodinov

Basically it works by calling:

Sender.notify_all(emails)

Then, uncomment the several functions to see different results 😉.

Interact with the send server

# start the GenServer
{:ok, pid} = GenServer.start(SendServer, [max_retries: 1])

# get the state
GenServer.call(pid, :get_state)

# send an email
GenServer.cast(pid, {:send, "hello@gmail.com"})

# send an email that will fail and see how the server handles this
GenServer.cast(pid, {:send, "konnichiwa@world.com"})

You could also control what will happen if the process exits:

{:ok, pid} = GenServer.start(SendServer, [])

GenServer.stop(pid)

About

Project for playing with some functions from the Task module. It simulates an email sending service

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages