Results 1 to 8 of 8

Thread: swf: all or nothing?

  1. #1
    Join Date
    Jun 2005
    Posts
    17

    Default 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. #2
    Join Date
    Aug 2004
    Location
    Melbourne, FL
    Posts
    2,794

    Default

    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.
    Keith Donald
    Core Spring Development Team

  3. #3
    Join Date
    Sep 2004
    Location
    Leuven, Belgium
    Posts
    1,853

    Default

    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

  4. #4
    Join Date
    Jun 2005
    Posts
    17

    Default

    Thanks!

  5. #5
    Join Date
    Sep 2004
    Posts
    133

    Default

    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

  6. #6
    Join Date
    Sep 2004
    Location
    Leuven, Belgium
    Posts
    1,853

    Default

    "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

  7. #7
    Join Date
    Sep 2004
    Posts
    133

    Default

    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

  8. #8
    Join Date
    Sep 2004
    Location
    Leuven, Belgium
    Posts
    1,853

    Default

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •