[JBoss jBPM] - Action in timer
by rodosa
Hello,
I've created a simply timer that shows a message. This is the timer:
| <event type='node-enter' >
| <create-timer name='timeout' duedate='10 seconds' repeat='yes' >
| <script>System.out.println("I reset my timer!");</script>
| </create-timer> </event> <event type='node-leave' >
| <cancel-timer name='timeout' />
| </event>
|
This works, but ... when I want that, instead showing this message an action was executed, doesn't work!! Why?? Could someone help me??
The timer is:
| <event type='node-enter'>
| <create-timer name='timeout' duedate='10 seconds'
| repeat='yes'>
| <action name="Tester"
| class="com.ideit.modules.cmmi.jbpm.requirements.session.TesterActionHandler">
| </action>
| </create-timer>
| </event>
|
And the TesterActionHandler class is:
| public class TesterActionHandler implements ActionHandler {
|
| private ExecutionContext ec = null;
| public Log log = LogFactory.getLog(this.getClass());
|
| public void execute(ExecutionContext context) throws Exception {
|
| //I want to execute a this content with the timer
| }
|
My class extends of ActionHandler is that correct??? Could someone explain me why the content of the execute method is not being executed???
Thanks a lot,
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4205524#4205524
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4205524
15 years, 4 months
[JBoss jBPM] - drools in jbpm-console
by nl@ap
Hi,
is there a way to get the rulesActionHandler example run in the jbpm-console?
I'm getting the following error on starting an instance:
08:12:36,160 ERROR [GraphElement] action threw exception: Unable to resolve ObjectType 'Customer' : [Rule name=Determine Shipper, agendaGroup=MAIN, salience=0, no-loop=false]
| Unable to resolve ObjectType 'Order' : [Rule name=Determine Shipper, agendaGroup=MAIN, salience=0, no-loop=false]
| org.jbpm.action.Customerorg.jbpm.action.OrderRule Compilation error : [Rule name=Determine Shipper, agendaGroup=MAIN, salience=0, no-loop=false]
| org/jbpm/action/Rule_Determine_Shipper_0.java (2:33) : Only a type can be imported. org.jbpm.action.Customer resolves to a package
| org/jbpm/action/Rule_Determine_Shipper_0.java (2:109) : Only a type can be imported. org.jbpm.action.Order resolves to a package
|
| org.drools.rule.InvalidRulePackage: Unable to resolve ObjectType 'Customer' : [Rule name=Determine Shipper, agendaGroup=MAIN, salience=0, no-loop=false]
| Unable to resolve ObjectType 'Order' : [Rule name=Determine Shipper, agendaGroup=MAIN, salience=0, no-loop=false]
| org.jbpm.action.Customerorg.jbpm.action.OrderRule Compilation error : [Rule name=Determine Shipper, agendaGroup=MAIN, salience=0, no-loop=false]
| org/jbpm/action/Rule_Determine_Shipper_0.java (2:33) : Only a type can be imported. org.jbpm.action.Customer resolves to a package
| org/jbpm/action/Rule_Determine_Shipper_0.java (2:109) : Only a type can be imported. org.jbpm.action.Order resolves to a package
|
| at org.drools.rule.Package.checkValidity(Package.java:424)
| at org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:394)
| at org.jbpm.action.RulesActionHandler.readRule(RulesActionHandler.java:95)
| at org.jbpm.action.RulesActionHandler.execute(RulesActionHandler.java:39)
| at org.jbpm.graph.def.Action.execute(Action.java:122)
it looks like drools can't find any of the deployed beans, while it does find those if running in a standalone app. So I don't thing this is a drools problem.
Does anyone know how to resolve this problem?
BTW: I'm using jbpm-jpdl-3.2.3.
Thanks,
Niels
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4205454#4205454
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4205454
15 years, 4 months
[JBoss jBPM] - Re: jbpm 3.2 Session Is Closed exception in JobSession
by srLucas
Hi,
I am experiencing the same issue here. I haven't found the solution yet (I might try the posted solution here) but wanted to post the problem for future reference...
the error I am getting is the following:
17:53:07,343 [http-8080-4] INFO ContextAdvice : ----------> ContextAdvice in action, opening ctx
| 17:53:21,234 [http-8080-4] DEBUG JbpmContextInfo : creating jbpm context with service factories '[tx, message, scheduler, logging, persistence, authentication]'
| 17:53:21,250 [http-8080-4] DEBUG JbpmContext : creating org.jbpm.JbpmContext@93f17f
| 17:53:21,250 [http-8080-4] INFO ContextAdvice : --------------> reusing existing jbpmContext: org.jbpm.JbpmContext@93f17f
| 17:53:26,281 [http-8080-4] DEBUG DbPersistenceServiceFactory : creating persistence service
| 17:53:26,296 [http-8080-4] DEBUG DbPersistenceService : creating hibernate session
| 17:53:26,296 [http-8080-4] DEBUG DbPersistenceService : beginning hibernate transaction
| 17:53:31,343 [http-8080-4] DEBUG DbPersistenceService : begun hibernate transaction org.hibernate.transaction.JDBCTransaction@537c91
| 17:53:31,531 [http-8080-4] INFO ContextAdvice : ----------> ContextAdvice in action, closing ctx
| 17:53:51,562 [http-8080-4] DEBUG JbpmContext : closing jbpmContext org.jbpm.JbpmContext@93f17f
| 17:53:51,578 [http-8080-4] DEBUG Services : closing service 'persistence': org.jbpm.persistence.db.DbPersistenceService@362a7b
| 17:53:51,593 [http-8080-4] DEBUG DbPersistenceService : committing hibernate transaction org.hibernate.transaction.JDBCTransaction@537c91
| 17:53:51,625 [http-8080-4] DEBUG DbPersistenceService : closing hibernate session
| 17:53:51,640 [http-8080-4] DEBUG Services : closing service 'tx': org.jbpm.tx.TxService@384d34
| 17:53:51,812 [http-8080-4] ERROR LoggingSession : org.hibernate.SessionException: Session is closed!
And here is a bit of explanation.
I have a ContextAdvice Object that opens/closes the context when you enter/leave the service logic.
package com.ea.dc.jbpm.context;
|
| import java.lang.reflect.Method;
|
| import org.apache.log4j.Logger;
| import org.jbpm.JbpmConfiguration;
| import org.jbpm.JbpmContext;
| import org.springframework.aop.AfterReturningAdvice;
| import org.springframework.aop.MethodBeforeAdvice;
|
| /** Class used to intercept calls to services and initialize the jbpmContext
| * in order to make it transparent to the coder.
| *
| * @author lucas.gonzalezp
| */
| public class ContextAdvice
| implements MethodBeforeAdvice, AfterReturningAdvice {
|
| /** The class logger. */
| private static final Logger LOGGER = Logger.getLogger(ContextAdvice.class);
|
| /** jbpm configuration. */
| private JbpmConfiguration jbpmConfiguration = null;
|
| /** Opens the context. */
| public void before(Method method, Object[] args, Object target)
| throws Throwable {
| LOGGER.info("----------> ContextAdvice in action, opening ctx");
| getContext();
| }
|
|
| /** Closes the context. */
| public void afterReturning(Object returnValue, Method method,
| Object[] args, Object target) throws Throwable {
| LOGGER.info("----------> ContextAdvice in action, closing ctx");
|
| JbpmContext jbpmContext = jbpmConfiguration.getCurrentJbpmContext();
| if (jbpmContext != null) {
| jbpmContext.close();
| } else {
| // TODO: throw exception?
| LOGGER.fatal("----------> CONTEXT NOT FOUND, SOMEONE ELSE CLOSED IT");
| }
| }
|
| /** Looks for a current JBPMContext. If it does not exists it will create
| * a new one.
| * @return a jbpm context
| */
| private JbpmContext getContext() {
| // Lookup the pojo persistence context-builder that is configured above
| JbpmContext jbpmContext = jbpmConfiguration.getCurrentJbpmContext();
|
| if (jbpmContext == null) {
| jbpmContext = jbpmConfiguration.createJbpmContext();
| LOGGER.info("--------------> creating new jbpmContext: "
| + jbpmContext);
| }
| return jbpmContext;
| }
|
| /** Sets the jbpmConfiguration for this bean.
| * @param config the jbpm configuration to set
| */
| public void setJbpmConfiguration(final JbpmConfiguration config) {
| jbpmConfiguration = config;
| }
| }
|
and here is one of the failing methods:
public List<JobDTO> getJobs() {
| List<JobDTO> result = new ArrayList<JobDTO>();
|
| // Lookup the pojo persistence context-builder that is configured above
| JbpmContext jbpmContext = getContext();
|
| // let's obtain a graph session to get the process instances
| GraphSession graphSession = jbpmContext.getGraphSession();
| // now let's get the process instance
| ProcessDefinition procDef = graphSession.findLatestProcessDefinition(
| WorkFlowServiceImpl.PROCESS_NAME);
|
| List<ProcessInstance> instances =
| graphSession.findProcessInstances(procDef.getId());
|
| for (Iterator iterator = instances.iterator(); iterator.hasNext();) {
| ProcessInstance processInstance = (ProcessInstance) iterator.next();
| result.add(populateJob(processInstance));
| }
|
| return result;
| }
|
So I understand that ContextAdvice closes the jbpmContext --> HibernateSession and then the LogSession throws the error.
Is it possible to flush/close the LogSession before the context is closed?
thanks,
Lucas
- I am using springmodules 0.8a
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4205393#4205393
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4205393
15 years, 4 months
[JBoss jBPM] - Notion of start-task
by Thomas.Kriechbaum
First of all, I'm a great fan of jBPM and its flexibility. Caused to this flexibility custom requirements can often be solved in different ways.
I'm using a start-task to assign the initial actor to a swimlane. Since the process is started by an ESB-event (e.g. user orders a new product via a service) the start-task should not be displayed in the user's task list (no further input or activity is required at this point). In this case, I immediately end the task-instance via an action handler (task-assign event). Is this a proper solution or rather an anti-pattern?
Is it correct that the start-task is also indented to collect/define the process initial variables? I find it helpful, to see the required variables within the start-task definition. But these initial variables could also be assigned to a process instance directly while starting it (as I mentioned before, the process is started by another service).
I know not very high-level technical questions; rather low-level patterns questions.
Thanks
Thomas
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4205341#4205341
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4205341
15 years, 4 months