Announcement Announcement Module
Collapse
No announcement yet.
swf: all or nothing? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • swf: all or nothing?

    I'm evaluating SWF as we're considering using it for our project. We are already using SpringMVC.

    Can we mix SWF freely with non-SWF (i.e., plain vanilla MVC controllers, for example)? Are there caveats or requirements to make this work? I guess my question comes from my lack of understanding of the flow lifecycle and how flows are invoked and created. When a request comes in, how are flows created vs. re-used? For example, is it the lack of a (valid) flowExecutionId which causes a new flow to be started? Is this documented anywhere?

    Does hitting a top-level flow invalidate other flows? I'm thinking specifically of a web application with global menu items for starting new flows.

    Thanks,
    Jim

  • #2
    Yes, mixing and maxing is very much expected. SWF is not all or nothing. It is designed to be used WITH traditional controllers, e.g Spring MVC controllers, Struts actions, or JSF navigation handlers -- as a compliment. After all, SWF itself is a specialized controller that is considerably more powerful, fit for controlled navigations that drive business proces workflows.

    See the flow launcher sample for the various strategies for launching flows within an application.

    Comment


    • #3
      Can we mix SWF freely with non-SWF?
      Absolutely, as Keith explains.

      Are there caveats or requirements to make this work?
      Not really. You can call into a normal controller from inside a flow and visa-versa.

      When a request comes in, how are flows created vs. re-used?
      A new flow execution is created when a request comes into the FlowController that does not specify a _flowExecutionId parameter, just as you expected. This is documented in the FlowExecutionManager JavaDoc.

      Does hitting a top-level flow invalidate other flows?
      No it doesn't, so you could have multiple flows running concurrently in the same HTTP session. If you do want to invalidate other flows in the same HTTP session when a new top-level flow starts, you can easily do that using a FlowExecutionListener that scans the session for FlowExecutions when a new flow starts.

      Erwin

      Comment


      • #4
        Thanks!

        Comment


        • #5
          Hi Erwin,

          No it doesn't, so you could have multiple flows running concurrently in the same HTTP session. If you do want to invalidate other flows in the same HTTP session when a new top-level flow starts, you can easily do that using a FlowExecutionListener that scans the session for FlowExecutions when a new flow starts.
          Can you explain further , l don't understand "multiple flows running concurrently" , did you means that we can execute multiple flows at the same time ?

          moon

          Comment


          • #6
            "multiple flows running concurrently (in a single HTTP session)" == "execute multiple flows at the same time (in a single HTTP session)"

            This is a completely supported, but rare use case. For instance: you could imagine that a user has 2 browser windows open, both connected to the same HTTP session. In the first browser window he is interacting with flow-A, while in the second browser window he uses flow-B. Both flows are completely independen of eachother.

            Erwin

            Comment


            • #7
              Oh , ic...
              l thought you can run two same flows at the same time ... , but what if the user execute 2 same flows at the same time ?
              Thanks.

              moon

              Comment


              • #8
                As I said, the concurrenty executing flows are completely independent. So in general, you could have N flows running concurrently in a single HTTP session. For instance, 2 executions of the same flow definition ("flowA") is possible.

                Erwin

                Comment

                Working...
                X