-
1. Re: Starting Threads and Socket listeners
dcowan Oct 20, 2007 3:50 PM (in response to dcowan)I did some research on this and was wondering what peoples thoughts on using a Resource Adapter to do this or is there a more general way to do it in seam. My sockets that listen need to access my beans in a synchronous manner so mdb's are out.
-
2. Re: Starting Threads and Socket listeners
dhinojosa Oct 20, 2007 11:21 PM (in response to dcowan)You can't call a session bean remotely and invoke it from your client? Doing that is synchronous.
-
3. Re: Starting Threads and Socket listeners
pmuir Oct 23, 2007 7:47 AM (in response to dcowan)The normal approach here is to write a JCA adaptor. But this does require an endpoint in your application. Another option is to use the Seam Manager component pattern (@Unwrap).
Dan's approach also seesm good to me. -
4. Re: Starting Threads and Socket listeners
dcowan Oct 29, 2007 9:40 PM (in response to dcowan)I currently use an application scoped bean to start the Socket listener so using the Seam Manager compenent sounds like a good option. If I used that would Threads created from the socket threads be able to call the manager in the context of a transaction?
-
5. Re: Starting Threads and Socket listeners
dcowan Nov 6, 2007 10:02 PM (in response to dcowan)For anyone that stumbles upon this I solved this by using Lifecycle.beginCall within my callback method
Lifecycle.beginCall(); try { IEventDataService eventDataService = (IEventDataService) Component.getInstance("eventDataService", true); eventDataService.createEventData(eventData.getDevice().getIdentifier(), eventData); Lifecycle.endCall(); } catch (Exception ex) { ex.printStackTrace(); }