4 Replies Latest reply on Feb 6, 2007 2:24 PM by clandestino_bgd

    Asynchronous WS invocation - advice needed

    clandestino_bgd

      Dear JBPM people.
      I have the folowing problem and just wondering how to design particular process, so I thought I may ask for some help here.

      In one node I have to invoke my implementation of ActionHandler that will call my WS asynchronously.
      The node then should stay in wait state
      When WS sends response, my callback method should resume process and fire leave transition.
      I have studied the documentation, but am not sure what would be the most suitable process design approach.
      This node should not be performed by human, but should act as a system one.

      Any hint, advice, small example, thoughts?
      Thank you in advance!
      Regards
      Milan

        • 1. Re: Asynchronous WS invocation - advice needed
          aguizar

          Use a state node. Invoke your existing service from an action handler associated with the node-enter event. Create a new web service for your existing service to call back. In the new service implementation, load the token and signal it.

          • 2. Re: Asynchronous WS invocation - advice needed
            clandestino_bgd

            Hi,
            first thank you for response.

            Yesterday I figured out something similar related to using State and invoke action which will call WS on node-enter event.
            However, I am not sure what should I invoke in my WS callback method.

            Should I pass to WS only process instance ID , assuming that I will have only one leaving transition from the State.
            And then in callback method to obtain processInstance and to call:
            processInstance.signal()

            OR:
            should I also ALSO pass State (Node) name to WS,
            find Token in Process instance and call token.signal():

            Thanx for your support.
            Regards
            Milan

            • 3. Re: Asynchronous WS invocation - advice needed
              aguizar

              In general you need the tokenId (long), in case you model a process with multiple branches of execution and the transitionName (String), should you have multiple outgoing transitions at some point.

              With these parameters, use jbpmContext.loadToken(tokenId), then call token.signal(transitionName).

              You don't need the state, because the Token object you load will already contain a pointer to it.

              • 4. Re: Asynchronous WS invocation - advice needed
                clandestino_bgd

                Done.
                Works very nice.
                Thank you!