Search

Categories

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Send mail to the author(s) E-mail

# Monday, 06 August 2012
( AppFabric | WF4 )

code: http://code.msdn.microsoft.com/WF4ContosoHR/

video: http://blogs.msdn.com/b/endpoint/archive/2010/10/08/endpoint-tv-wf4-appfabric-contoso-hr-sample.aspx

Application Demo

This will be on the Azure 2008R2 VM http://edinburgh.cloudapp.net/HRApplicationServices  for a short period:

image

If None or Bachelors is pressed the a ‘No thank you’ email is sent to the email given here

image

image
If Masters or PhD were pressed then:

image
Email sent to HR Admin

image
No Hire would have given a similar email to above, and Hire would give:

image

 

Uses EF for persistence

1. WebApp sends a message to a Workflow Service… starts to manage .. ie really sending to a WebService.
2. HR Data, and WorkFlow state is saved in Persistence DB
3. Connects to another service to screen app.. if yes
4. Send email to human reviewer (long running!)
5. Goes to web app to say hire or no hire
6. Notify applicant

image
Conf wizard for the app helps get dev environment setup well.  Instead of following d/load link I used Web Platform Installer for this.

Windows Server AppFabric

Windows Server AppFabric is a set of integrated technologies that make it easier to build, scale and manage Web and composite applications that run on IIS.

image

image
Installed the db’s here

image

image
Main workflow file SubmitApplication.xamlx – which uses ScreenEducation.xamlx

image
Unit testing and debugging information

Phase 1 - Receive Application from Website via Webservice

Application Service - Sequence
Receive Application - TransactedReceiveScope – Whole thing is a transaction

ReceiveRequest is a Messaging.Receive – This is how we create a WebService with WF (no custom code)

image

The type SubmitJobApplicationRequest is simply:

namespace HRApplicationServices.Contracts
{
    using System.Runtime.Serialization;
    using System;
    
    [DataContract(Namespace="http://contoso.com/contracts/hr")]
    public class SubmitJobApplicationRequest
    {
        [DataMember(IsRequired=true)]
        public ApplicantResume Resume { get; set; }

        [DataMember(IsRequired = true)]
        public Guid RequestID { get; set; }
    }
}

Serialization / DataContracts which is .NET4 used here.. helps with EF possibly
RequestID is simply a GUID made up on the Default.aspx page

 

Save and Respond

image
Created a CodeActivity (ie custom activity written in code)

image

Use the ApplicationID got back from DB so the caller knows.

 

image
WF4 uses content based correlation to know what key to use for the Workflow instance..using xpath we are assigning the ApplicationID from EF.

image
SaveJobApplication returns back the response to the SendResponse Action with text from the resources file.

Phase 2 – Screen Application

image

image
Calls Auto Screen Education first which could have been a webservice, but here is a workflow being called.

image

image
Passed in an Education, then gets back a boolean.

image
Human Screening is a Sequence
While Human Is Unresponsive is a While
Request Human Screening is custom which inherits CodeActivity (and overrides Execute)

image
Respond or timeout logic

Testing

Even if I stop debugging of the application, then emails (and workflow) will still operate.  AppFabric.

Deploying

image
image
View output when press Build Deployment Package, and it gives a nice hyperlink to the files produced.
cmd script would allow me to deploy to many servers

In IIS, Deploy, Import Application, then just need zip file

Put in connection string information

Management Application, enabled named pipes

image

image

Setting up AppFabric on the server, as the dependency checker for this sample didn’t work on the server.

image
Not sure why the name is not AppFabricPersistenceDB (which is what the db is called).

Manage service configuration…AppFabricPersistenceDB, don’t want to keep after complete
AutoStart to enabled
Needed to upload the actual HRApplicationDB to live

AppFabric Dashboard

Very useful for debugging eg wrong connection strings.

| | # 
# Friday, 03 August 2012
( WF4 )

 

WF4 Getting Started Tutorial – Steve Danielson.. Number Guessing Game
http://code.msdn.microsoft.com/windowsdesktop/Windows-Workflow-164557c3#content
This needs .NET4.0.1 (downloading Targeting Pack 4.0.3 – 4th March 2012) which includes a state machine.

| | #