commonMain.raven.EmailService.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of raven-email-core-jvm Show documentation
Show all versions of raven-email-core-jvm Show documentation
An abstraction form sending emails
package raven
import koncurrent.FailedLater
import koncurrent.Later
class EmailService(
private val agents: Collection>
) : Service {
override fun send(params: SendEmailParams): Later {
val main = agents.firstOrNull() ?: return FailedLater("Main EmailAgent not found in email service")
val others = agents - main
for (agent in others) agent.send(params)
return main.send(params)
}
}