3 Replies Latest reply on Nov 18, 2005 4:05 PM by Aparna Krishna

    Looping after signal

    Tim Squires Newbie

      Hi,

      I have a process containing states that send JMS messages and wait for JMS replies before signalling. Once the reply is received in the listener thread, the ExecutionConext for the ActionHandler is stale and the db session is closed. I reload the ProcessInstance and signal but the process loops back the beginning of the same task.

      A snip of the process definition is

      <state name="Remote Job 1">
       <event type="node-enter">
       <action class='actions.RemoteJobHandler'>
       <command>remoteJob1 a b c</command>
       </action>
       </event>
       <transition name="next" to="Remote Job 2"></transition>
      </state>
      <state name="Remote Job 2">
       <event type="node-enter">
       <action class='actions.RemoteJobHandler'>
       <command>remoteJob2 a b c</command>
       </action>
       </event>
       <transition name="next" to="Remote Job 3"></transition>
      </state>


      The code used to signal, which is run from the onMessage of the JMS listener...
      public void signal( ExecutionContext executionContext )
      {
       ContextBuilder contextBuilder = ContextBuilder.create( "pojo" );
       try
       {
       contextBuilder.begin();
       GraphSession graphSession = JbpmSessionContext.getGraphSession();
       ProcessInstance processInstance = graphSession.loadProcessInstance( executionContext.getProcessInstance().getId() );
      
       Token token = processInstance.getRootToken();
       if ( logger.isDebugEnabled() )
       logger.debug( "signaling from node " + token.getNode().getName() );
      
       token.signal();
      
       if ( logger.isDebugEnabled() )
       logger.debug( "signaling moved us to " + token.getNode().getName() );
       }
       finally
       {
       contextBuilder.end();
       }
      }


      This code just loops round "Remote Job 1" until I kill it. There's no splits so signaling on the root token I think should be OK.

      I've upgraded to the latest CVS (19th Sep 2005) and moved from the deprecated JbpmSessionFactory to the ContextBuilder stuff with the hope of a solution but not joy.

      Anyone know how to fix my signal?

      Thanks,
      Tim