How to start a JBPM Work Flow remotely???
cr3 Jun 12, 2008 12:01 PMHi there,
Does anybody know how to start a JBPM Work Flow remotely?
What I want to do is Instance a new Process from a remote server (a Nagios server when an alarm appears).
The code that I think that could do this is:
JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext(); ProcessInstance processInstance = jbpmContext.newProcessInstance("Gestion de Problemas"); processInstance.signal("Enviar");
but I cannnot figure it out how to initialize the variable "jbpmConfiguration".
When I was in a Node of the JBpm I used:
JbpmContext jbpmContext =context.getJbpmContext();
where context is an object of the class ExecutionContext, but as you can see I don't have this class because I want to start the process remotely ;).
I tried as well to use this:
JbpmConfiguration jbpmConfiguration = JbpmConfiguration.parseXmlString(xml);
Where the String xml is:
String xml="<jbpm-configuration>"+
"<jbpm-context>"+
"<service name=\"persistence\" factory=\"org.jbpm.persistence.db.DbPersistenceServiceFactory\" />"+
"<service name=\"tx\" factory=\"org.jbpm.tx.TxServiceFactory\" />"+
"<service name=\"message\" factory=\"org.jbpm.msg.db.DbMessageServiceFactory\" />"+
"<service name=\"scheduler\" factory=\"org.jbpm.scheduler.db.DbSchedulerServiceFactory\" />"+
"<service name=\"logging\" factory=\"org.jbpm.logging.db.DbLoggingServiceFactory\" />"+
"<service name=\"authentication\" factory=\"org.jbpm.security.authentication.DefaultAuthenticationServiceFactory\" />"+
"</jbpm-context>"+
"<string name=\"resource.hibernate.cfg.xml\" value=\"hibernate.cfg.xml\" />"+
"<string name=\"resource.business.calendar\" value=\"org/jbpm/calendar/jbpm.business.calendar.properties\" />"+
"<string name=\"resource.default.modules\" value=\"org/jbpm/graph/def/jbpm.default.modules.properties\" />"+
"<string name=\"resource.converter\" value=\"org/jbpm/db/hibernate/jbpm.converter.properties\" />"+
"<string name=\"resource.action.types\" value=\"org/jbpm/graph/action/action.types.xml\" />"+
"<string name=\"resource.node.types\" value=\"org/jbpm/graph/node/node.types.xml\" />"+
"<string name=\"resource.parsers\" value=\"org/jbpm/jpdl/par/jbpm.parsers.xml\" />"+
"<string name=\"resource.varmapping\" value=\"org/jbpm/context/exe/jbpm.varmapping.xml\" />"+
"<string name=\"resource.mail.templates\" value=\"jbpm.mail.templates.xml\" />"+
"<int name=\"jbpm.byte.block.size\" value=\"1024\" singleton=\"true\" />"+
"<bean name=\"jbpm.task.instance.factory\" class=\"org.jbpm.taskmgmt.impl.DefaultTaskInstanceFactoryImpl\" singleton=\"true\" />"+
"<bean name=\"jbpm.variable.resolver\" class=\"org.jbpm.jpdl.el.impl.JbpmVariableResolver\" singleton=\"true\" />"+
"<string name=\"jbpm.mail.smtp.host\" value=\"localhost\" />"+
"<bean name=\"jbpm.mail.address.resolver\" class=\"org.jbpm.identity.mail.IdentityAddressResolver\" singleton=\"true\" />"+
"<string name=\"jbpm.mail.from.address\" value=\"jbpm@noreply\" />"+
"<bean name=\"jbpm.job.executor\" class=\"org.jbpm.job.executor.JobExecutor\">"+
"<field name=\"jbpmConfiguration\"><ref bean=\"jbpmConfiguration\" /></field>"+
"<field name=\"name\"><string value=\"JbpmJobExector\" /></field>"+
"<field name=\"nbrOfThreads\"><int value=\"1\" /></field>"+
"<field name=\"idleInterval\"><int value=\"5000\" /></field>"+
"<field name=\"maxIdleInterval\"><int value=\"3600000\" /></field> <!-- 1 hour -->"+
"<field name=\"historyMaxSize\"><int value=\"20\" /></field>"+
"<field name=\"maxLockTime\"><int value=\"600000\" /></field> <!-- 10 minutes -->"+
"<field name=\"lockMonitorInterval\"><int value=\"60000\" /></field> <!-- 1 minute -->"+
"<field name=\"lockBufferTime\"><int value=\"5000\" /></field> <!-- 5 seconds -->"+
"</bean>"+
"</jbpm-configuration>";
But as you guess it, it doesn't work as well.
Thanks in advance for your cooperation (If I got one hehe...)
Christian