-
1. Re: Cross-context events
cpopetz Dec 2, 2008 3:58 PM (in response to marios)Indeed application scoped components can raised events which are observed by session-scoped components, but this is only true for the session-scoped components that are in the active session context when the event is fired. In your use case, you're wanting to fire an event to be observed by components in all session scopes, and that won't work.
My suggestion would be to have your pbx-listener component insert rows in the database representing calls, and have your web tier poll the database either on each hit or via ajax to see what calls are available.
-
2. Re: Cross-context events
marios Dec 2, 2008 4:12 PM (in response to marios)Thanks for the feedback. I already store such phone information in the DB so I'm going to do this way since my today experimentation with message-driven beans have met no success (but this is another story ;)).
-
3. Re: Cross-context events
jguglielmin Dec 2, 2008 5:11 PM (in response to marios)I have done this in ICEfaces and have found raising events and listening/Observing them in an application-scoped bean to be very effective. My Observer method in the application-scoped bean would then do a render push. For example, you may have an event-scoped (or whatever-scoped) bean that adds a new call record to the database and would then trigger an event. Once a record is successfully persisted to the database, you would then trigger an event which is observed in the application-scoped bean. Since each of your sessions is registered to the OnDemandRenderer (ICEfaces ajax-push setup which is extremely simple), then you just fire the push from the application-scoped bean and each of the views that has been registered is updated. No MDB's required. (if there are large numbers of calls, you might want to keep an application-scoped list available to minimize hits to the database).
-
4. Re: Cross-context events
cpopetz Dec 2, 2008 5:31 PM (in response to marios)Another aspect I failed to mention...seam events aren't cluster aware, but a database polling solution (or an MDB solution) is.
I never like to assume that any webapp will always be hosted on one vm.
-
5. Re: Cross-context events
vladimir.kovalyuk Dec 2, 2008 5:32 PM (in response to marios)Interesting ... What was the problem with MDB? MDB seems the right way to go in that case.
-
6. Re: Cross-context events
jguglielmin Dec 2, 2008 5:42 PM (in response to marios)From an ICEfaces perspective, then I would use the BroadcastRenderer and push the registered views directly from the method that persisted the new Call record. The BroadcastRenderer does the MDB work for you. It would be interesting though to try a more EJB3 approach with Seam though.... (with the MDB's triggering a local node's push). It's always interesting to see how others view the same tasks and solve them.