Fully mature activity

Hello,
How to develop fully mature activity…? Means perfect activity which should handle error, wait to complete previous one and repeat if fail 3 times then… exit the workflow by loging error in log file…how to achive this? Like by use of exception handling and log messges what else needed ?
Thanks

For that purpose you might want to have a look at REFramework ,