5 Replies Latest reply on May 15, 2007 4:18 AM by kukeltje

    Blocked signal call

    avivstav

      Hi
      I wrote a simple flow that use web events as trigger to continue the flow.

      I use the following code to start the flow:

      public Long startFlow(long id,String problem, long sid) {
      
       Long processDefId = null;
       JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
       try {
      
       GraphSession graphSession = jbpmContext.getGraphSession();
      
       ProcessDefinition processDefinition =
       graphSession.findLatestProcessDefinition("start");
      
       ProcessInstance processInstance =
       new ProcessInstance(processDefinition);
      
       ContextInstance contextInstance = processInstance.getContextInstance();
       contextInstance.setVariable("id", id);
       contextInstance.setVariable("problem", problem);
       contextInstance.setVariable("sid" , sid);
       contextInstance.setVariable("processDefId" , processDefinition.getId());
      
       Token token = processInstance.getRootToken();
      
       token.signal();
       jbpmContext.save(processInstance);
      
       } finally {
       return processDefId;
       }
       }
      


      And I also wrote second method which continue to other states in the flow.
      As I understand each call to signal() moves one step in the flow in non-blocking mode,
      Is it possible that the token.signal() will be blocked until the ActionHandler defined for that state ended?
      I want to response the caller of that method (startFlow) with variable returned in the ContextVariable of the ActionHandler, is it possible?

        • 1. Re: Blocked signal call
          kukeltje

          what is 'that state'? The current one (for the signal) or the next one where the signal should lead to?

          If actionhandlers are synchronous, the method is 'blocking' afaik

          • 2. Re: Blocked signal call
            avivstav

            Yes 'That state' I mean to current state
            the action handler do some job: save record in DB
            AS I mentioned eralier the start trigger for the flow is web based ( using Ajax) and it seems the Ajax call is back while the action handler related to the current node is running,
            Thats what I mean the signal() is non blocking operation, am I right?

            • 3. Re: Blocked signal call
              kukeltje

              It depends if the action is async or not (like stated in my previous post)

              • 4. Re: Blocked signal call
                avivstav

                What do you mean depends on the implementation,
                How is the JBPM engine implement and manage the Flow? why is it related to my implementation?
                Suppose my ActionHandler only pring message to log and update record in DB using hibernate,

                • 5. Re: Blocked signal call
                  kukeltje

                  please, please, please read the documentation on actionhandlers and the async functionality.