Tuesday, 5 October 2010

AppFabric Hosting PowerShell Cmdlets

This seems to be the place for the AppFabric Hosting PowerShell Cmdlets:

The following shows the current state of my AppFabric. It has nothing persisted.

I start a workflow that I know will persist to my persistence store:

I can then look back at my AppFabric dashboard and see that 1 workflow is persisted and active.

I can then open Windows PowerShell Modules. It calls this from the server menu behind the scenes:
%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -NoExit -ImportSystemModules

Ok so it's loaded. Now, just as a simple example we can query for all instances in the default persistence store.

We call "Get-ASAppServiceInstance".

It returns all the info about my persisted workflow instance.

This is interesting as I have just noticed that I have an extra unnecessary service contract name, a spelling mistake and hence an extra bookmark.

Ok, so I went in, altered the service contract name to get rid of the extra IService ref as it should only have an  IExpenseService ref. I also renamed my bookmark from ManagerActionComplete to ManagerActionCompleted. Then I re-ran my workflow thinking all was ok.

An exception was thrown so obviously I just did something incorrectly.

I re-ran my "Get-ASAppServiceInstance". and saw the following information which of course is very obvious:

The exception is:
ExceptionMessage: A bookmark with the name 'ManagerActionCompleted|{}IExpenseService' already exists.

Obviously I just named a bookmark in my workflow to the same name as another one.

I renamed ManagerActionCompleted to ManagerActionCompletedReminder as this bookmark gets resumed after a delay activity expiration time has elapsed.

So "Get-ASAppServiceInstance" now shows:

We then wait for the delay time to expire and run "Get-ASAppServiceInstance" again and we then see:

Ok so I set off to write myself an investigative blog into  Windows PowerShell Modules for AppFabric and this technology already showed me a couple of issues with my workflow. Nice!!

Again, look at this link for loads of other useful commands: