I have most of the times worked on spring based projects. Recently I got a chance to design business layer based on EJB 3.
Below are the observations based on my experience.Any architect may consider EJB 3 , for these aspects.
- JMS Consumers: When you need to develop JMS consumers: EJB supported MDB are simplest JMS consumers having annotated transaction support.
- Asynchronous Communication: In EJB 3.1, session beans support asynchronous method invocations. Bean methods annotated with @Asynchronous are invoked asynchronously. When a client invokes methods with the @Asynchronous annotation, the container immediately returns control to the client and invokes the method in a different thread. The method may return a future object to allow the client to check on the status of the method invocation, and retrieve result values that are asynchronously produced. EJB 3.1 supports this feature by using Future, which is part of standard java concurrency. Future represents the result of an asynchronous computation. It supports both model of communication:,
- Retrieve-result-later asynchronous methods having Future<?> return type.
- Fire-and-forget asynchronous methods having void return type
- Multi node deployment
- Distributed Application: EJB3 support for remoting and simple distributed transaction support makes spring first choice for distributed applications.
- State-full Behavior
You can achieve all the features with other frameworks as well, but one need to develop custom components or integrate other frameworks, while these features are embedded in EJB 3 and can be applied easily.