Discussions

EJB programming & troubleshooting: how to send events to a java application client in j2ee???

  1. Hi, Im reading about EJBs and conainers, but i dont read anything about how to send events form j2ee server to a java application client. At now, i understand that a java application lookup a ejb, send it a request by his component interface, the ejb receive the request and send back the response to the client, with for example a data transfer object. But what happen if a event occur inside a j2ee container??, how can my ejbs send a events to the clients that are connected???, for example a ejb stateful bean that have a conversational states might want to send a event to his client that begin the conversation i think that this is possible using a message driven beans, but how can instanced it outside of the j2ee container??? maybe the client could get a jndi queue refrence and stay listen it??, this is the only way, using message driven beans to inform the current java application clients?? thanks in advance
  2. This type of capability is not provided for by J2EE, except perhaps by an event being handled by an MDB which is responsible for pushing the event to the client(s). An alternative approach is something like the Coherence "Real Time Client" (two-way connection into a Java Data Grid). Peace, Cameron Purdy Tangosol Coherence: The Java Data Grid
  3. Or can we look it from a different angle? Instead of the Server pusing events to the client, can't the client poll the server for any "events"?
  4. Or can we look it from a different angle?
    Instead of the Server pusing events to the client, can't the client poll the server for any "events"?
    Sure, but its way more expensive and will have higher latencies. Peace, Cameron Purdy Tangosol Coherence: The Java Data Grid
  5. Thank you for all the answers, I will practise with this
  6. As mentioned by yourself & Cameron use an Message Bean. Yeray, you need to understand the actual purpose of a container. It is to provide services. In this case receive the message from the queue. The MDB can in turn call java helper classes or other services to process the requests. Multiple clients can also be polled using the Messaging framework. If you are looking for cross app interportability do checkout ESB (e.g MQ and Mule or OpenESB). Job Schedules are also available (Opensyphony Quartz) -Vinant Pandey