The guidelines for implementing a BusinessProcessManager and the Asynchronous Business Process pattern are similar to those for implementing any asynchronous processes. These guidelines center on performance and reusability of the infrastructure:
Build a generic job manager and reuse it for all business processes: Job management is a difficult and complex task for programmers. Funneling all business processes through a single job manager allows you to centralize policies for process priorities and simplify the management of the asynchronous behavior of your system.
Evaluate your clients carefully : If your business process can guarantee execution time under the client's threshold of pain, keep the process synchronous. Simply put, the burden of job management for a short process can double or triple the amount of time it takes to fulfill the process. Further, clients enjoy immediate responses from a system whenever possible. The corollary to this rule takes into account processes that sometimes or always exceed a client's threshold of pain. An application should create a consistent and usable interface. If an asynchronous job is needed some of the time, you may as well submit it to the job manager all of the time. Not only will the interface be consistent for the end user , but the programming environment is simpler and easier to manipulate.
Build job recovery into your job manager: Some of the business processes you implement can take days and weeks to complete. To ensure you do not lose important processes, the state must remain consistent and available in persistent storage. When an application restarts, the job manager needs to restart any partially completed business processes when the system went down.
Spend time understanding how external Business Process pattern implementations called from your own business activities fit into your own asynchronous business process implementation: Specifically, what are the identifiers and data returned that you have to retain and track, how does this data affect the status and progress of your own business process as reflected to the user, and is the asynchronous or synchronous behavior of a business process and the identifying data standardized? Each of these decisions can increase the complexity of your underlying Business Process pattern implementation as well as affect your asynchronous business process logic.
Use a thread pool for executing business processes: Business processes are the most active part of an application. Creation and completion of threads creates a heavy burden on the Java Virtual Machine's garbage collector. Using thread pooling helps alleviate some of this burden.