Presentation is loading. Please wait.

Presentation is loading. Please wait.

Integrating and Extending Workflow 8 AA301 Carl Sykes Ed Heaney.

Similar presentations


Presentation on theme: "Integrating and Extending Workflow 8 AA301 Carl Sykes Ed Heaney."— Presentation transcript:

1 Integrating and Extending Workflow 8 AA301 Carl Sykes Ed Heaney

2 Table of Contents -Introduction -Scripts -Activities -Services -Deployment

3 Requirements Required: -Windows Workflow Foundation (.NET 3.0) -VB.NET or C#.NET Recommended: -Visual Studio 2005 or higher

4 Introduction - Workflow Integration Options: -Scripts -Activities Advanced Integration Options: -Workflow Runtime Services -Windows Communication Foundation (WCF)

5 Workflow Architecture

6 Workflow Terminology Activity – Basic unit of a workflow, a step in the workflow process Runtime – The part of the workflow service that executes the workflow Designer – The application that allows you to create workflows which can be executed Workflow Server – The service that executes and manages published workflows Workflow Subscriber – The service that monitors Laserfiche repositories for events that are of interest to workflows

7 Scripts “Internal” workflow integrations

8 Scripts - Introductions Code snippets that are compiled to perform custom workflow actions Script activities are part of the workflow rule

9 Workflow Definitions An activity is an object you place on the workflow canvas:

10 Workflow Definitions - continued The workflow canvas is the collection of all activities that make up your rule:

11 Workflow Definitions - continued These are created in the Designer:

12 Scripts - Activities ‘Scripting’ Category in the toolbox Script Activities: Script (C#) Script (VB) Toolkit (C#) Toolkit (VB)

13 What is the difference? Script Activity –A basic script that does not ‘talk’ to a Laserfiche server Toolkit Script –Provides a connection to Laserfiche –Retrieves an entry from the repository

14 Sample – Script activity C# Visual Basic

15 Sample – Toolkit script C# Visual Basic

16 All Scripts – Pros and Cons Pros: Easy to write ‘Hands free’ integration Customizable Cons: ‘Slower’ Harder to debug Limited

17 Cons explained Scripts have to be loaded and executed ‘on the fly’ when workflows run Debugging is difficult. We’ve provided the ‘MsgBox’ to help (It shows a message box!) Scripts are limited to one ‘code file’ and can not add additional references

18 Scripts - Features Advanced Editor: Code suggestions Export/Import Syntax Highlighting Tokens: Creating Replacing Testing

19 Scripts – Code suggestions Code suggestions and auto-complete

20 Scripts – Syntax Highlighting Keywords and string highlighting

21 Scripts – Compile Errors Compile errors are clearly reported.

22 Scripts - Tokens Tokens used in the script can be tested

23 Toolkit Script – Picking an entry Starting Entry Other workflow entries

24 About Using Scripts When to use: -For a simple, one time only task. -Setting a token -Setting a property When not to use: -A task that may be needed in more than one workflow, especially if there are variable properties.

25 Activities Custom Workflow actions

26 Workflow Activities – Two Parts Runtime (Workflow Activity): -Execution -Persistence Design Time (Activity Proxy): -Properties -Publishing Custom activities are made of two parts

27 Activities and Proxies The ‘Runtime’ workflow activity is a Windows Workflow activity and is executed on the Workflow Server. The ‘Design Time’ workflow activity is called an Activity Proxy and runs in the Workflow Designer.

28 Runtime

29 Runtime Activities Windows Workflow Activity Runs on workflow server Does the ‘work’

30 Runtime Activities – Keep it simple Examples of simple: Create an entry Change template fields Send an email Examples of not simple: More than one task at a time Activities should perform simple tasks.

31 Runtime Activities – Keep it short Workflow execution time is scarce. Example of short: Simple Tasks Processing a row in a database table. Example of not short: OCR / Image Processing Iterating through a database table Waiting on an event*

32 Runtime Activities – Keep it Small Long running workflows are saved (persisted) -Any class variable in the activity will be saved -Do not have ‘large’ variables in your activities -Data Sets -Large arrays, collections, or lists -Use the NonSerialized (MSDN) attribute on any necessary large variable(s)NonSerialized (MSDN)

33 Terminology Attributes –An attribute is metadata for code. More on Attributes (MSDN) VB C#

34 Create a ‘Workflow Activity Library’ Visual Studio

35 Runtime Activities – Creating Add a reference to System.Workflow.ComponentModel (MSDN)System.Workflow.ComponentModel Derive/Inherit from System.Workflow.ComponentModel.Activity (MSDN) System.Workflow.ComponentModel.Activity Implement the Execute Method (MSDN) Execute Method

36 Runtime Activities - Laserfiche Alternatively, use the LaserficheActivity Connects to a Laserfiche repository Add a reference to Laserfiche.Workflow Derive/Inherit from Laserfiche.Workflow.Activities.LaserficheActivity Implement the OnExecuteCode method

37 Runtime Activities - Resources Windows Workflow: Building Custom Activities Activity Persistence Windows Workflow Foundation Activities

38 Design Time User Interface

39 Workflow Designer

40 Toolbox Canvas Property Viewer

41 Proxies and the Workflow Designer The Activity Proxy Generator utility will generate the code to display your activity in the Toolbox, Canvas, and Property Viewer The proxy will have default properties, serialization, and publishing code

42 Activity Proxy Generator

43 Creating a proxy Use the proxy generator! –Browse to your activity assembly (the.dll!) –Choose the base class Activity Proxy – Your activity derives from ‘Activity’ LaserficheActivityProxy – Your activity derives from ‘LaserficheActivity’ –Save the file or Copy and Paste –Customize Properties Serialization Publishing

44 Proxy Tips Public properties show up in the property pane. The property pane makes use of attributes to customize how properties look. Property types like ‘int’ and ‘string’ are supported out of the box. Complex property types will require more work.

45 Attribute Example [DisplayName(“Activity Name”)] public string Name { get; set; } ‘String’ displays a text box

46 Simple ‘custom’ property control [EditControl(typeof(EditMultilineTextBoxControl))] public string Description { get; set;} EditControlAttribute is used to customize how a property is edited in the Designer

47 Complex ‘custom’ property control

48 Publishing - Overall Publishing – The process of taking a designed workflow and preparing it to be executed on the Workflow Server. Involves –Serialization (Loading and Saving) –Code Generation (also called Publishing) –Compiling

49 Publishing Serialization Publishing Process Workflow Designer saves WFX Workflow Xml File Uploads Workflow Server Generates and Compiles Workflow Code File

50 What is Serialization? Serialization is the creation of the Workflow Xml File (.wfx) Two Methods to be implemented: –ReadProperties XmlReader (MSDN)XmlReader (MSDN) –WriteProperties XmlWriter (MSDN)XmlWriter (MSDN) Generated by the proxy generator –PropertySerializer class –MemberwiseSerializableAttribute IXmlSerializable interface (MSDN)

51 What is Publishing? Code Generation –Generate code that sets the properties of the runtime activity. –Produces a code file Publishing of many properties are handled automatically by workflow. Generated by the proxy generator Advanced code generation –CodeDOM Serialization (MSDN)CodeDOM Serialization (MSDN)

52 Deployment

53 Workflow Server Side The activity’s assembly must be placed somewhere that is accessible by the workflow server The configuration file for the workflow server must be updated to look for the assembly in the location Restart service after modifying the configuration file

54 Workflow Service Configuration File

55 Workflow Designer Side Activities should be placed in the CommonFiles\Laserfiche\Workflow\Activities folder on the designer machine Your activity should now be available as a toolbox item

56 Troubleshooting Tips Saving and Opening files from the workflow designer will help find serialization issues Exporting to a Windows Workflow will help find publishing issues Make sure the deployment steps are completed on the Workflow Service before attempting to publish a workflow with your new activity

57 Advanced Integration Topic

58 Advanced Topics Runtime Services –Runtime services can be added to the configuration file. These are needed to handle complex actions like event handling. WCF Services –Workflow communicates using WCF services. These services can be used by other applications. SQL Tables –All workflow activity is stored in SQL tables. These tables can be read to gather statistical information about workflows and activities.

59 Runtime Workflow Services Adding Workflow Services (MSDN)Adding Workflow Services WorkflowRuntimeService class (MSDN)WorkflowRuntimeService class

60 WCF Services Creating A WCF Client (MSDN)Creating A WCF Client Interacting with WCF Services (MSDN)Interacting with WCF Services

61

62

63 Windows Workflow Foundation Benefits: -Scalable -Reliable -Extensible Links: -http://netfx3.com/content/WFHome.aspxhttp://netfx3.com/content/WFHome.aspx -http://msdn2.microsoft.com/en-us/library/aa973808.aspxhttp://msdn2.microsoft.com/en-us/library/aa973808.aspx


Download ppt "Integrating and Extending Workflow 8 AA301 Carl Sykes Ed Heaney."

Similar presentations


Ads by Google