2 Replies Latest reply on Jun 3, 2008 9:52 AM by tnfink

    Seam and JBPM timers

    dahm

      Hi,


      we are using JBPM in our application and there is a timer-related state:



        <state name="WaitingForReversal">
          <event type="node-enter">
                     <action name="sendAnswerMessage" expression="#{jbpmPaymentProcessor.sendAnswerMessage}"></action>
                </event>
                <timer duedate="60 seconds" name="waitingForReversalTimer" transition="bookingCompleted"></timer>
          <transition to="isReversalRequestValid" name="reversalRequest"></transition>
          <transition to="BookingSuccessfullyCompleted" name="bookingCompleted"></transition>
        </state>



      However, the transition does not fire automatically.
      The JBPM job executor/scheduler needs to started.


      What is the recommended way to do this with Seam? Can
      you use Seam/EJB timers and configure it somewhere in components.xml or jbpm.cfg.xml?


      I found some other posts about this topic, but none seemed to have a definite answer.


      What we are currently doing is to add the Job Executor Servlet to our web.xml:


      <servlet>
          <servlet-name>JobExecutorServlet</servlet-name>
          <servlet-class>org.jbpm.job.executor.JobExecutorServlet</servlet-class>
          <load-on-startup>1</load-on-startup>
        </servlet>
        <servlet-mapping>
          <servlet-name>JobExecutorServlet</servlet-name>
          <url-pattern>/jobs</url-pattern>
        </servlet-mapping>
      



      This works, but produces the following log output:


      6:29:41,921 JbpmJobExector:192.168.10.212:1 WARN  [ProxyWarnLog] Narrowing proxy to class org.jbpm.job.Timer - this operation breaks ==
      16:29:42,000 JbpmJobExector:192.168.10.212:1 ERROR [JobSession] org.hibernate.TransactionException: could not register synchronization
      16:29:42,218 JbpmJobExector:192.168.10.212:1 WARN  [ProxyWarnLog] Narrowing proxy to class org.jbpm.job.Timer - this operation breaks ==
      16:29:42,234 JbpmJobExector:192.168.10.212:1 ERROR [JobSession] org.hibernate.TransactionException: could not register synchronization
      



      I guess that it wants to synchronize itself with EJB transaction manager...? So what is the best solution in your opinion?


      Thanks in advance
        Markus

        • 1. Re: Seam and JBPM timers
          kukeltje.ronald.jbpm.org

          You can also configure jBPM to use ejb timers. The 'could not register sychronization' is most often caused by having configured hibernate or jBPM to use a jee specific transactionmanager and not using an xa datasource (afaik).


          The warnings van be ignored (also afaik)

          • 2. Re: Seam and JBPM timers
            tnfink

            Is there an example or a documentation about how to use an EJB-timer for the job scheduler?


            BTW, is it not a little bit strange, that the servlet actually works? The jBpm process starts actions on Seam method, thus, the executor thread needs an initialized Seam context. With EJB it would get it via the Seam-EJB interceptor. But I would assume that a usual servlet does not get a Seam context.


            Best regards,


              Torsten