Re: [jboss-user] [jBPM] - How to start/spawn 'n' subprocesses for 'n' users using JBPM-4.3.
by Al Nadein
Al Nadein [http://community.jboss.org/people/matrixpooh] replied to the discussion
"How to start/spawn 'n' subprocesses for 'n' users using JBPM-4.3."
To view the discussion, visit: http://community.jboss.org/message/553170#553170
--------------------------------------------------------------
Hi Felix,
A unique constrain for ID_ on JBMP4_EXECUTION is there to ensure that there don't exist more than 1 process with the same id. Since the only client of this database is the pvm (jbpm process virtual machine) and it's designed having this restriction in mind, there is really no harm to drop the constrain. Being a perfectionist, I still think there should be a code fix, rather than relaxation of the data model constrains.
The reason of the error is really a bug. A process is created, then a fork is hit, a child process is created. Both operations are done in memory, nothing is being recorded in a database just yet. Then either a wait state or end of a process is hit. At this moment, a system would try to persist the records: there will be 2 records created - one for the main process, another for the child process. 2 insert statements would be issued, both of them will have "ID_" set to null just because at that moment neither of ID_ values has been calculated yet. This is done with the assumption that there will be a calculation of ID_ values and the updates will be issued immediately in the same transaction. But in this setup, updates have no chance to be issued since the transaction fails to insert the second record due to a duplicate ID_ value, i.e. null. The question is why not to calculate ID_ value upfront and make a single insert instead of insert and then update.
I did work with HuieSheng to identify and resolve the bug, but then was pulled into some other things and didn't have a chance to follow up on her patch. In short, my project is in production with my patch. Will try to fetch it for you shortly.
Also, wanted to say huge thanks for your process sample: creating an arbitrary number of subprocesses is something I've been trying to do for a while.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/553170#553170]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
15 years, 9 months
Re: [jboss-user] [JBoss Messaging] - Failed to get a server session
by santhosh pulichinthala
santhosh pulichinthala [http://community.jboss.org/people/santhoshreddy747] replied to the discussion
"Failed to get a server session"
To view the discussion, visit: http://community.jboss.org/message/553138#553138
--------------------------------------------------------------
HI,
Can you please send me your MDB code to fix this problem.Im also having same issues.Im also recieving the message as message listener.
Im attaching my MDB code please let me know if i did anything wrong.
Thanks
santhosh
mdb main code:
// Source File Name: EskomMDB.java
//@author santhosh pulichinthala
package za.eskom.jms.ejb;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ejb.EJBException;
import javax.ejb.MessageDrivenBean;
import javax.ejb.MessageDrivenContext;
import javax.jms.MessageListener;
import javax.jms.Queue;
import javax.jms.Message;
import javax.jms.TextMessage;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
// Referenced classes of package za.eskom.jms.ejb:
// EscapeChars, GTXSOAPCalling , GetSoapXmlByMsgType , PersistentSoapTarget
public class GtxEskomFourthInstanceMDB implements MessageDrivenBean, MessageListener {
private MessageDrivenContext mdcontext;
String soapTargetValue = null;
private boolean instantiated;
String messageType = "";
InitialContext initialContext = null;
Thread currentThread = null;
public GtxEskomFourthInstanceMDB() {
mdcontext = null;
instantiated = getVariables();
}
public void setMessageDrivenContext(MessageDrivenContext mdc)
throws EJBException {
mdcontext = mdc;
}
public void ejbCreate() {
}
public void ejbRemove() {
}
private boolean getVariables() {
// TODO Auto-generated method stub
String variableName = "";
try {
// createQueueConnetion();
initialContext = new InitialContext();
Context context = (Context) initialContext.lookup("java:comp/env");
variableName = "SoapTargetValue";
soapTargetValue = (String) context.lookup(variableName);
variableName = "MessageType";
messageType = (String) context.lookup(variableName);
return true;
} catch (NamingException excepton) {
logger.log(Level.SEVERE, "Missing environment variable ("
+ variableName + ") from ejb-jar.xml .");
return false;
}
}
public void onMessage(Message inMessage) {
TextMessage msg = null;
String xmlString = "";
String xmlToSend = "";
Queue subscribedQueue;
try {
subscribedQueue = (Queue) inMessage.getJMSDestination();
logger.log(Level.INFO, "Received JMS message ("
+ inMessage.getJMSMessageID() + ") from Queue ("
+ subscribedQueue.getQueueName() + ").");
if (inMessage instanceof TextMessage) {
msg = (TextMessage) inMessage;
xmlToSend = msg.getText().toString();
if (instantiated) {
logger.log(Level.INFO,
"MESSAGE BEAN: Got the message Type : "
+ messageType + " and SoapTargetValue : "
+ soapTargetValue);
} else {
logger.log(Level.SEVERE,
"MESSAGE BEAN: Failed read values from ejb-jar.xml for xml Message"
+ msg.getText().toString());
mdcontext.setRollbackOnly();
}
xmlString = GetSoapXmlByMsgType.getMessageType(messageType,
xmlToSend);
logger.log(Level.INFO,
"MESSAGE BEAN: Calling Gtx Soap process :");
GTXSOAPCalling
.callingGtxSoapProcess(soapTargetValue, xmlString);
}
} catch (Throwable e) {
// TODO Auto-generated catch block
try {
mdcontext.setRollbackOnly();
} catch (Exception f) {
logger.log(Level.SEVERE,
"Failure when trying to rollback transaction");
}
logger.log(Level.SEVERE,
"Failed to submit JMS message with an exception - "
+ e.getMessage());
}
}
private static final long serialVersionUID = 1L;
private static Logger logger = Logger.getLogger("GtxEskomMessageBean");
}
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/553138#553138]
Start a new discussion in JBoss Messaging at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
15 years, 9 months