JBoss Community

Re: saving state after workitem

created by Chris Melas in jBPM - View the full discussion

Hi,

I tried out your code on jboss7, mysql and it worked fine with the following changes applied,

 

1. Introduce a KnowledgeRuntime field in your handler,

public class SaveStateWorkItemHandler implements WorkItemHandler {

    private KnowledgeRuntime session;

 

    public SaveStateWorkItemHandler() {

    }

 

    public SaveStateWorkItemHandler(KnowledgeRuntime session) {

        this();

       this.session = session;

    }

......

 

2. Complete the work item in your SaveStateWorkItemHandler as follows,

....

System.out.println("******** END SAVE-STATE SLEEP *************");

session.getWorkItemManager().completeWorkItem(myWorkItem.getId(), null);

 

3. Register your handler accordingly,

ksession.getWorkItemManager().registerWorkItemHandler("SaveState", new SaveStateWorkItemHandler(ksession));

Reply to this message by going to Community

Start a new discussion in jBPM at Community