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

retry module integration #2

Open
softprops opened this issue Aug 16, 2013 · 6 comments
Open

retry module integration #2

softprops opened this issue Aug 16, 2013 · 6 comments
Milestone

Comments

@softprops
Copy link
Collaborator

would like to retry if a send fails. this should use retry to retry futures

@danielgratzl danielgratzl added this to the 0.2.1 milestone Jan 23, 2017
@daddykotex
Copy link
Collaborator

Let's reopen if someone ask for that.

@colindean
Copy link

Consider this an ask for retry! I'd love to rip out the direct JavaMail implementation in https://github.com/target/data-validator and use something more idiomatic.

@daddykotex
Copy link
Collaborator

Will look into it soon.

What would be an ideal interface for you to implement this, can you share some code?

@daddykotex daddykotex reopened this Jan 14, 2022
@colindean
Copy link

Thanks for considering this!

In this comment, I explored a pair of retry solutions that met my expectations for interface and code quality (I've implemented internal retry libraries in three languages at three companies in the last decade, so I've got strong opinions loosely held, haha). Either will do just fine, I think.

The builder pattern in courier.Session lends itself well to adding a retry configuration case class. The courier.Mailer#apply method would consume that configuration here:

Future {
Transport.send(msg)
}

Since courier is already using Futures there, it's probably cleanest to use SoftwareMill's retry package. The above would be come something like this:

val retry = buildRetryPolicyFromConfig(_session.retryConfig)
retry(() => Future {
      Transport.send(msg)
})

@daddykotex
Copy link
Collaborator

One month later, sorry, life happens ehh.

I'm checking it out today.

The plan would be to put that feature in a separate artifact: courier-retry to let user import it if they want to.

@daddykotex
Copy link
Collaborator

WIP: #61

I need retry for scala 3: softwaremill/retry#39

I would like some feedback from you @colindean. See the readme update in the PR and let me know what you think.

More specifically, what do you think of:

  • exposing the retry.Policy directly in the RetryConfig class. this provide users (you) the most control over the behavior at the expense of simplicity (for example, only taking a maximum number of attempt and using a simple retry.Pause(numberOfAttempts, 10.seconds) under the hood)
  • the extension method on the Mailer (via the Retry._ import)

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

No branches or pull requests

4 participants