You basically miss the Java EE and MDB points.
The Java EE container is a managed runtime. The fundamental idea of ββthe Java EE container is that, by delegating certain orthogonal problems to the container, such as transaction management, the component is still focused on business logic and (in utopia) is a reusable component that does not accept the assumption about the runtime.
Before MDB, the Java EE container was a passive-reactive system that did not allow the coordination of asynchronous active agents on the container side. Message Driven Beans then addressed this by providing a standard way to trigger asynchronous server-side actions.
You have an original e0 event that is consumed by MBD0 . In message MDB0 e1 will be generated and a message will be sent in response to MBD1 , which will then do its job and send msg to MDB2 , etc.
There you have a simple workflow of n consecutive steps using pub / sub messaging semantics (and o / c with asynchronous semantics), and all involved threads are managed by the container. If you want the actors to work simultaneously and then collect the results and begin the final action, consider using templates related to JMS themes.
source share