[jboss-user] [JBoss jBPM] - Process definition instanciation (java call)
Wash
do-not-reply at jboss.com
Tue May 29 06:28:05 EDT 2007
Hi Guys !
We are trying to start a new jBPM process instance from java code, is there any sample code to perform it properly? We are able to send a notification for an suspended instance, but when we try to create an instance, then we don't have a jobId which must be specified.
As we know a JobID is normally related to a pending task and not for a creation.
Our code looks like:
InitialContext ic = new InitialContext();
| QueueConnectionFactory qcf = (QueueConnectionFactory) ic.lookup("XAConnectionFactory");
| qc = qcf.createQueueConnection();
| qc.start();
| session = qc.createQueueSession(true, QueueSession.AUTO_ACKNOWLEDGE);
| Queue queue = (Queue) ic.lookup("queue/JbpmCommandQueue");
| QueueSender sender = session.createSender(queue);
|
| //ObjectMessage msg = session.createObjectMessage();
| ObjectMessage om = session.createObjectMessage();
|
| HashMap<String, Object> map = new HashMap<String, Object>();
| map.put("long99", new Long(99));
| map.put("stringABC", "ABC");
| map.put("boolean", new Boolean(false));
| om.setObject(map);
|
| org.jbpm.command.NewProcessInstanceCommand newProcessInstanceCmd = new org.jbpm.command.NewProcessInstanceCommand();
|
| newProcessInstanceCmd.setActorId("ernie");
| newProcessInstanceCmd.setCreateStartTask(true);
| newProcessInstanceCmd.setProcessId(38L);
| newProcessInstanceCmd.setProcessName("ProcessName");
| newProcessInstanceCmd.setVariables(map);
|
| om.setObject(newProcessInstanceCmd);
| //om.setLongProperty("jobId", 286L);
| sender.send(om);
| sender.close();
| session.commit();
Wash
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4049245#4049245
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4049245
More information about the jboss-user
mailing list