Announcement Announcement Module
Collapse
No announcement yet.
FlowExecutionListener - how to intercept and redirect user Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • FlowExecutionListener - how to intercept and redirect user

    What is the right way to intercept a flow and redirect the user to a different state?

    I assume I will want to use FlowExecutionListener. I'd like to be able to signal a new event, regardless of what the user was doing. This looks like I want to use the resuming() method but I'm not sure how to signal an event when I just have a handle on the requestContext.

    The scenario is, we have a large flow that is manipulating a particular object. This object has its own internal state that we manage as the user goes through the flow. It is possible for the internal state of this object to be changed outside of the flow, by a different process. We need to be able to detect this change, and redirect the flow user (I assume signal a new event) to a different flow state.

    Thanks.

  • #2
    Here is what I ended up doing, for future readers (and for anyone who has suggestions):

    In the pausing() method of my FlowExecutionListener, I examine the object and store the status on a flow scoped attribute.

    In the resuming() method, I compare the status of the object with the value stored in flowScope -- if they are different an exception is thrown.

    In my flow I defined a global transition to handle this exception, which redirects the user to the appropriate state based on the status change.

    Comment


    • #3
      Hi,

      your solution is cunning but a hack. I was wondering if someone else has figured out a more standard way of solving this problem in the meantime?

      Cheers,
      Michael

      Comment


      • #4
        Hack or not, I think I need this same capability and found your example working for me too. To my surprise, though, throwing an Exception (necessarily an unchecked Exception, no?) from the requestSubmitted() method did not get handled by my on-exception clause, while doing it from the resume() method did. Something to do with in which part of the Post-Redirect-Get cycle those methods are called?

        Comment

        Working...
        X