4 Replies Latest reply on Jul 14, 2008 7:43 PM by clandestino_bgd

    the best way for this kind of assignment?

    clandestino_bgd

      Hi,
      Here is what I need to do:
      1. take one task among pooled tasks for particular user (OK)
      2. asynchronously invoke some web service and wait for the callback
      3. after received callback assign task to the particular user
      The problem is that #2 I've done so far with the State and Action Handler on node-enter event. This is just fine.

      But how can I accomplish scenario mentioned above?
      If I put action handler on some event in task node, how (where, when) I can receive callback?
      In synchronous scenario, everything can be done straightforward, but what about asychronous, I need here?

      Hints, comments, welcome and highly appreciated.
      Milan

        • 1. Re: the best way for this kind of assignment?
          clandestino_bgd

          Hi,
          just to ask if the question is
          either inappropriate for this forum,
          or not clear,
          or completely senseless,
          or too specific, so nobody wants to bother,
          or people who can answer are too busy in last 4 days?

          I would be very happy to know this.

          Thanks
          MIlan

          • 2. Re: the best way for this kind of assignment?
            sdickerson.perse

            I haven't implemented this yet, but here's what I'm planning to do for this senerio:

            Create a servlet or webservice that the external application can access to signal the process execution. The signal that is sent from the external application would match up to one of the defined transitions.

            When the external application is called from the process execution, the process id will be passed to it, so when the external app is done it can signal the process execution that called it.

            In addition to the signal, I may need to provide for the external application sending a serialized variable map or maybe just a http query string to set process variables. For instance, if the external application generates a file that the process execution will need to know about, I plan to pass the file location back to be set in a process varible.

            Does this sound possible?

            Scott

            • 3. Re: the best way for this kind of assignment?
              clandestino_bgd

              Hi Scott,
              first thank you for response.
              I do not know if you missed the part when I am saying that I do exactly the same thing when I have WAIT STATE as you described.
              The problem is how to do that when TASK is created/assigned.

              So, on task-create event you can call WS from action handler
              but then, it would be great if I can somehow receive callback (how, what to signal, resume, call from external app?) and then assign task by calling setActorId().

              I hope that this gives more light to my problem.
              And I really hope, somebody has an answer.
              Thanks
              Milan

              • 4. Re: the best way for this kind of assignment?
                clandestino_bgd

                Hi, here is the answer (to my own question):
                1. In task-node (on node-enter event) I create N task instances for particular task (inside ActionHandler). A task belongs to the swimlane, which has assignment handler that sets pooled actors.
                2. User lists all pooled tasks, takes first found and sets his username as actorId for that task instance.
                3. On task-assign event, I am calling ActionHandler, which invokes Web Service asynchronously.
                4. When WS makes a callback, I have method which starts task instance and makes it available for external user.

                The task node snippet:

                <task-node name="annotate" create-tasks="false">
                 <event type="node-enter">
                 <action name="createAnnotationTasksActionHandler"
                 class="org.springmodules.workflow.jbpm31.JbpmHandlerProxy"
                 config-type="bean">
                 <targetBean>createAnnotationTasksActionHandler</targetBean>
                 </action>
                 </event>
                 <event type="task-assign">
                 <action name="gasActionHandler"
                 class="org.springmodules.workflow.jbpm31.JbpmHandlerProxy"
                 config-type="bean">
                 </action>
                 </event>
                
                 <task description="Annotate Document" swimlane="annotator"></task>
                 <transition to="join1"></transition>
                </task-node>
                


                best,
                Milan