Notification.scala contains all the necessary implementations and a couple of missing ones. Using Scala's Futures implement the problem parts below:
-
Part 1
- Send notification for
debitorcredittransactions on a customer’s bank account. - Implement either
creditordebitoperation. - You must send both the messages SMS and Email upon a successful transaction.
- Send notification for
-
Part 2
- Retry any service method -
sendSmsorsendEmailuntil 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
enableSMSAfterorenableEmailAftermethods onNotificationServiceto test.
- Retry any service method -
-
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’sdebitorcreditimplementation to see it in action.