-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better define integration with EJB and CDI #197
Comments
@glassfishrobot Commented |
@glassfishrobot Commented |
@glassfishrobot Commented |
@glassfishrobot Commented I already linked your issue to this one, see "Issue links" section. |
@glassfishrobot Commented |
|
+1 for better integration with CDI. |
One of the items I would like to see better addressed in a future WebSocket API version is integration with EJB and CDI.
The case for CDI integration is likely fairly self-explanatory so there no point repeating it. However, perhaps it is important to make the case for EJB integration. Direct EJB integration is a very good fit for RAD code where transactions, persistence, etc are used directly in a WebSocket service. Now while much of this functionality is available outside EJB, some of it is not such as thread safety, asynchronous processing and scheduling. Specifically it may be important to hash out the following questions:
1. Do stateless session beans map to WebSocket endpoints (the likely answer is no)?
2. Can stateful session beans be WebSocket endpoints? I think the likely answer is yes if you treat the WebSocket session as an EJB session, hence having a stateful session bean instance per remote client. @remove could be called automatically when the WebSocket session is closed (just like CDI conversations).
3. Can singleton session beans be WebSocket endpoints? I think the likely answer is yes and it would provide very useful thread safety services across all remote clients on an endpoint (that can be fine tuned as needed).
4. Is the caller Principal passed on to EJB from WebSocket (I think the answer is yes)?
5. WebSocket could have some really nice synergy with @asynchronous.
6. What methods can overlap with @schedule, EJB life-cycle callbacks and other remote/local end-points?
There are similarly interesting questions to address as to CDI integration:
1. Will @transactional work in a WebSocket endpoint? How about @observes, @stereotype, @produces, @Disposes, etc?
2. Perhaps @dependent could fit per-peer model?
3. @ApplicationScoped/@singleton would be a good fit for a shared endpoint model.
4. @ConversationScoped, @RequestScoped probably do not map well to WebSocket.
5. I think @SessionScoped would be a great fit for a instance per-peer model, provided HTTP session ~= WebSocket peer.
Do let me know if anything needs to be explained further - I am happy to help.
Please note that these are purely my personal views and certainly not of Oracle's as a company.
The text was updated successfully, but these errors were encountered: