2 Replies Latest reply on Nov 12, 2007 7:37 AM by pmuir

    How to start jbpm business process from an async quartz meth

    pietermartin

      Hi,

      I have tried calling

      package com.yannitech.virgin.bpm.session;
      
      import java.util.Date;
      
      import org.jboss.seam.ScopeType;
      import org.jboss.seam.annotations.Logger;
      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.annotations.Scope;
      import org.jboss.seam.annotations.Transactional;
      import org.jboss.seam.annotations.async.Asynchronous;
      import org.jboss.seam.annotations.async.Expiration;
      import org.jboss.seam.annotations.async.FinalExpiration;
      import org.jboss.seam.annotations.async.IntervalDuration;
      import org.jboss.seam.annotations.bpm.CreateProcess;
      import org.jboss.seam.async.QuartzTriggerHandle;
      import org.jboss.seam.log.Log;
      
      @Name("pollPosForOBF")
      @Scope(ScopeType.CONVERSATION)
      public class PollPosForOBF {
      
       @Logger
       Log log;
      
       @Asynchronous
       @Transactional
       @CreateProcess(definition="OBFProcess")
       public QuartzTriggerHandle poll(@Expiration
       Date when, @IntervalDuration
       Long interval, @FinalExpiration
       Date endDate) {
       log.info("Async poll happening ja wol");
       return null;
       }
      
      }
      


      The code executes but the a instance of the business process is not created.

      What is the correct way to start a jbpm business process from an async process?

      Thanks
      Pieter

        • 1. Re: How to start jbpm business process from an async quartz
          pietermartin

          Solved,

          @Name("pollPosForOBF")
          @Scope(ScopeType.CONVERSATION)
          public class PollPosForOBF {
          
           @Logger
           Log log;
          
           @In(create=true)
           private OBFProcessAction oBFProcessAction;
          
           @Asynchronous
           @Transactional
           public QuartzTriggerHandle poll(@Expiration
           Date when, @IntervalDuration
           Long interval, @FinalExpiration
           Date endDate) {
           log.info("Async poll happening ja wol");
           oBFProcessAction.startOBFBusinessProcess();
           return null;
           }
          }
          
          @Name("oBFProcessAction")
          public class OBFProcessAction {
          
           @Logger Log log;
          
           @Out(scope=ScopeType.BUSINESS_PROCESS, required=false)
           String orderId;
          
           @CreateProcess(definition="OBFProcess")
           public void startOBFBusinessProcess() {
           log.info("startPolling");
           orderId = new UID().toString();
           }
          }
          
          


          Seams like delegating @CreateProcess made it work, not sure why tho.

          Cheers

          Pieter

          • 2. Re: How to start jbpm business process from an async quartz
            pmuir

            Please file a JIRA issue for this, looks like a bug to me.