Some comments inline. Thanks, Raymond
From: Vamsavardhana Reddy Sent: Wednesday, February 04, 2009 9:41 AM To: [email protected] Subject: Does callback support for EJB3 session beans make sense? As part of the Tuscany plugin for Geronimo, I was looking at providing SCA services from session beans, and then started wondering if callback support for session beans makes sense. Here are some questions and comments I have: 1. If an EJB 3 business interface has an @Callback annotation on it, what does it mean when this EJB is invoked as a regular EJB, say from a Servlet. Does it mean that the Servlet will have to implement the callback interface? What happens when the Servlet invokes the EJB as an SCA service? <rfeng>I think the callback is an interaction pattern between the client and the component. The client has to be an SCA component that implements the callback interface. Since implementation.web doesn't support SCA services, I think it cannot support callback (which is actually a service too). <rfeng> 2. If there is no callback is injected when the EJB is invoked as an EJB, does the EJB implementation need to distinguish it is an EJB call and service the request or throw an error since no callback is available? <rfeng>If the implementaiton.ejb component is not invoked from another SCA component, there won't be context for the request which guides how the callback can be made. I think it would be an error if an operation is invoked from non-SCA client that requires to make an SCA callback.</rfeng> 3. Even though the SCA JEE spec restricts that each EJB can be used as a component implementation at most once, when there are more than one component that has this EJB component as SCA reference target, the callbacks will have to be injected differently based on the component that is invoking the service. <rfeng>The idea is that there is context from the caller SCA component which helps the runtime to decide how to callback. The same case can happen for POJOs, for example PO1 and PO2 call PO3 and PO3 can call back to PO1 or PO2 depending on which caller is making the call.</rfeng> -- Vamsi
