DynamicOps or VMWare Cloud Automation Center has a great feature that can be adopted to provide data driven workflow execution.

As data within the VCAC database (or other MSSQL database) is changed (Create, Update or Delete) via the REST Interface, events can be configured to trigger workflows. The database row that triggered the event is provided as the workflow input argument.


Using the DynamicOps Workflow Generator (a Visual Studio utility within the VMWare Cloud Development Kit for VCAC) new events can be created and uploaded into the central repository. Here’s how…


We will add an event to the VirtualMachineTemplate (VCAC Blueprint) table to start a workflow when a new Blueprint is created, this could be useful if a centralised catalogue service, or a CMDB or service catalogues needs to be dynamically updated. This allows this to be done simple and in a declarative manner saving on lots of code that may be required if a polling service monitored this table instead.


Start a new Windows Workflow Visual Studio Project:


Remove Activity1.xaml file that the new solution creates for you.

Open the Workflow Generator tool (within Visual Studio Tools Menu)



Keep these default settings as configures the solution with correct DynamicOps dll’s and generates workflows/xml & deployment details.





Enter the workflow name – NewBlueprintWorkflow as an example, I always provide Workflow as the suffix as best practice.

Select the WorkflowTemplate WorkflowOperationEvent, this can be used to generate events and execute the workflow when triggered.



Select Workflow Deployment Tab and remove Workflow, leaving the event name as “NewBlueprint”, again best practice.

Click Add to Project….

This will create the following files:

  1. NewBlueprintWorkflow – the xaml workflow that can be loaded into the DynamicOps repository. This will run the appropriate business logic when the event is triggered, ie: update a central service catalogue somewhere.
  2. Operation-NewBlueprintWorkflow.xml – An xml file that can be loaded into DynamicOps to turn this event into a machines’ right click menu (if appropriate which it isnt in this case)
  3. Event-NewBlueprintWorkflow.xml – The event file that will trigger the workflow – we will now modify this
  4. Readme-NewBlueprintWorkflow.txt – instructions on how to deploy these files into DynamicOps Application Server.

Edit the Event file
By default a WorkflowOperation is used as an event. This object/table is the default table to start workflows in the system.

It looks like this:


 
   
 

We will now change it to this:


  <entityEvent create=”1″ update=”0″ delete=”0″ entity=”VirtualMachineTemplates model=”ManagementModelEntities” workflow=”NewBlueprintWorkflow”>
 

  1. Alter the WorkflowOperation to VirtualMachineTemplates, so the event now monitors an alternate table
  2. Remove the EntityFilter, this is used as a constraint, in this case we will start a new instance of the NewBlueprintWorkflow every time a new one is created.

Upload the event into the DynamicOps repository with the CloudUtil command.

Thats it. Really simple way to start a workflow and execute business logic just by applying a new event into the system. Alternate databases can be modelled this way using the DynamicOps model manager too.
Enjoy