-
1. Re: jBPM application
kukeltje Oct 26, 2005 3:00 AM (in response to joshua_hj)MDB -> startprocess
good idea, although your problem of long running processes is a design error on your side. If you started the process, the mdb can end. Processes by themselves are asynchronous.EJB (cmp) -> for jBPM logic
hmm... entity beans should according to good practice not contain logic. Certainly not jBPM logic. Or do you mean you wrapped the jBPM factory in a sessionbean? -
2. Re: jBPM application
joshua_hj Oct 26, 2005 7:13 AM (in response to joshua_hj)Hi again, and thanks helping,
What you mean with ?Processes by themselves are asynchronous?? Inside my OnMessage method if I invoke a EJB method that instantiates a process instance, the OnMessage method only ends when the process ends, right? It does not run in background, right? The call waits until the process instance ends (I think).public void onMessage(Message msg) { try { if (msg instanceof TextMessage) { String order = ((TextMessage) msg).getText(); Queue queue = (Queue) msg.getJMSReplyTo(); Document rfs = null; StringReader xml = new StringReader(order); try { synchronized (parser) { parser.parse(new InputSource(xml)); rfs = parser.getDocument(); parser.reset(); } } catch (SAXException esax) { System.out.println(": XML inválido: " + order); return; } catch (IOException eio) { eio.printStackTrace(); } xml.close(); if (rfs.getElementsByTagName(Confirmacao).getLength() > 0) { log.info("Confirmação recebida"); //log.info(order); return; } if (queue != null) { //resposta if (rfs.getElementsByTagName(Resposta).getLength() > 0) { log.info("\n\n" + order); gestor.proc_order_resp(order); // } //ordem else { gestor.proc_order_req(order); }
About the CMP, my jBPM logic is outside the CMP, the logic is implemented with action handlers. Yes, I use the CMP for wrapping the sessionfactory, because I don?t want to create a sessionfactory for each ejbCreate, and I had to do that with SessionBeans. -
3. Re: jBPM application
joshua_hj Oct 26, 2005 7:21 AM (in response to joshua_hj)Sorry, i did not want to put all that code.
Anyway, the gestor is a local interface for the CMP.
For each type of message i get, i call the proc_order_req or the proc_order_resp and the onMessage only ends when the process instance ends. Has I told you before, I use a CMP because if the MDB container needs another instance of the CMP LocalHome interface it will not have to create a new seesionfactory again. And i cannot do that with Stateless Session Beans.
Thanks Joshua -
4. Re: jBPM application
kukeltje Oct 26, 2005 11:32 AM (in response to joshua_hj)Again I would not use business logic in a CMP/EJB. Besides that, once you start the process, the method returns and the bean can stop. Show me the code in the gestor please. I think you are either doing someting wrong or have written a 'piece of code that signals all states/tasks/... etc and when the process is in the end node, returns
Not having to create the sessionfactory is something the jbpm.sar file takes care of. Do you use that (if you run on jboss)