Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # SMS and Email Notification (Scala)
- ```Notification.scala``` contains all the necessary implementations and a couple of missing ones. Using Scala's ```Future```s implement the problem parts below:
- * **Part 1**
- * Send notification for ```debit``` or ```credit``` transactions on a customer’s bank account.
- * Implement either ```credit``` or ```debit``` operation.
- * You must send both the messages SMS and Email upon a successful transaction.
- * **Part 2**
- * Retry any service method - ```sendSms``` or ```sendEmail``` until a specified number of times.
- * Hint: For this write a generic retry method which consumes a CBN Future and returns a Future that succeeds or fails.
- * Enhance the above to now retry after every specified duration.
- * You can use the ```enableSMSAfter``` or ```enableEmailAfter``` methods on ```NotificationService``` to test.
- * **Part 3**
- * Using the earlier retry (from Part 2) caused multiple SMS’ and Email’s being sent, despite the success of intermediate future.
- * Change the behaviour of retry such that:
- * if any of the intermediate future succeeds, it stops retrying and exits.
- * if none of the futures succeeds, it retries until the specified number of times every specified duration
- * 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