Advertisement
Guest User

Untitled

a guest
Apr 25th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. # SMS and Email Notification (Scala)
  2.  
  3. ```Notification.scala``` contains all the necessary implementations and a couple of missing ones. Using Scala's ```Future```s implement the problem parts below:
  4.  
  5. * **Part 1**
  6. * Send notification for ```debit``` or ```credit``` transactions on a customer’s bank account.
  7. * Implement either ```credit``` or ```debit``` operation.
  8. * You must send both the messages SMS and Email upon a successful transaction.
  9.  
  10. * **Part 2**
  11. * Retry any service method - ```sendSms``` or ```sendEmail``` until a specified number of times.
  12. * Hint: For this write a generic retry method which consumes a CBN Future and returns a Future that succeeds or fails.
  13. * Enhance the above to now retry after every specified duration.
  14. * You can use the ```enableSMSAfter``` or ```enableEmailAfter``` methods on ```NotificationService``` to test.
  15.  
  16. * **Part 3**
  17. * Using the earlier retry (from Part 2) caused multiple SMS’ and Email’s being sent, despite the success of intermediate future.
  18. * Change the behaviour of retry such that:
  19. * if any of the intermediate future succeeds, it stops retrying and exits.
  20. * if none of the futures succeeds, it retries until the specified number of times every specified duration
  21. * Finally, use it the ```AccountService```’s ```debit``` or ```credit``` implementation to see it in action.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement