Jaa


Lesson 5: Resuming a Suspended Workflow Using AppFabric

Objective: To stop and restart a failed workflow.

Purpose: Understand how Microsoft AppFabric 1.1 for Windows Server persists idle or suspended instances, and how to resume a suspended workflow.

Prerequisites

Simulating a Suspended Workflow

To see AppFabric in action, we must simulate a broken workflow. When that occurs, the persisted workflow is suspended. To simulate this we will “break” the HRApplicationServices application temporarily by renaming the \mailbox folder to \mailbox2.

To interrrupt the HRApplicationServices workflow

  1. Navigate to the root of the computer’s hard disk.

  2. Rename the mail folder from \mailbox to \mailbox2

  3. In Internet Explorer, type or paste the application URL:

    https://localhost/HRApplicationServices
    
  4. In the application form, set the education level to Masters.

  5. Click the Apply button.

  6. In Windows Explorer open the mailbox2 folder. Note that no message file has been generated.

Viewing and Resuming a Suspended Workflow

Now that the workflow has been disrupted, AppFabric has persisted the suspended workflow. After fixing the application, you can resume the workflow.

To view the suspended workflow

  1. Open or return to IIS Manager.

  2. Under Connections, navigate to the HRApplicationServices node. Click the node to select it.

  3. Double-click AppFabric Dashboard.

  4. In the Persisted WF Instances section there is one suspended instance. Also note that there are no service exceptions or user defined errors listed. This is because the sample application did not throw an error that was caught by the client. But because the workflow was disrupted, AppFabric persisted the suspended workflow.

  5. Under the Persisted WF Instances section, double-click the suspended instance SubmitApplication.xamlx. The persisted instance appears in the list with the status of Suspended

    Suspended Instance

  6. Right-click the suspended instance and click View Tracked Events. (Other choices include Resume, Cancel, Terminate and Delete.)

  7. In the list of tracked events, click the event that is has an Error icon. The Details section below the list now contains the details of the selected error event.

    Error in Suspended Event

  8. Click the Errors tab.

    Error Detail

  9. Note the exception text. It includes the following:

    System.Net.Mail.SmtpException: Failure sending mail. ---> System.IO.DirectoryNotFoundException: Could not find a part of the path 'c:\mailbox

    In this scenario, that information is enough to fix the application. AppFabric has captured the exception text for analysis.

  10. Open Windows Explorer and rename the folder from \mailbox2 to \mailbox.

  11. Return to the AppFabric dashboard.

  12. Right-click the dashboard and click AppFabric Dashboard.

  13. Under the Persisted WF Instances section double-click the suspended instance SubmitApplication.xamlx.

  14. Right-click the suspended instance and click Resume.

  15. After a few seconds, right-click the instance again and click Refresh.

  16. In Windows Explorer open the mailbox folder. Note that there is now a message file in the folder.

  17. Double-click the item to open it and click Review the application. (If you do not have a mail-reader program, view the message with Notepad.exe and copy and paste the URL in the message to the application into your browser to see the HTML message. The URL resembles the following: https://localhost/HRApplicationServices/HireApproval.aspx?AppID=23 Note that the AppID is set to the applicant ID.)

  18. On the HTML page, click Hire to hire the applicant. Open the mailbox folder and note there is a final message file. Open it to see the good news.

  19. Return to the AppFabric dashboard.

  20. Right-click the dashboard and click Refresh. The dashboard will be updated and the idle instance will disappear from the Active or Idle Instances column.

What Did I Just Do?

You have simulated a disruption that resulted in a suspended workflow. After fixing the error, you have resumed the workflow using the dashboard.

See Also

Concepts

Lesson 1: Getting Started
Lesson 2: Deploying the HRApplicationServices Workflow Service
Lesson 3: Configuring the HRApplicationServices Application
Lesson 4: Monitoring the Health of the HRApplicationServices Application
Lesson 5: Resuming a Suspended Workflow Using AppFabric

  2012-09-12