Upload
benedikt-xander
View
107
Download
0
Tags:
Embed Size (px)
Citation preview
Workflow FoundationWorkflow Foundation
Christian BinderChristian BinderDeveloper Platform & Strategy GroupDeveloper Platform & Strategy GroupMicrosoft Deutschland GmbHMicrosoft Deutschland GmbH
[email protected]@microsoft.com
AgendaAgenda
Was ist die Workflow Foundation?Was ist die Workflow Foundation?
Architektur & KernkonzepteArchitektur & Kernkonzepte
Workflow Engine & ServicesWorkflow Engine & Services
Worklfow FoundationWorklfow Foundation
Windows Workflow Foundation ist Windows Workflow Foundation ist Programmiermodell, Engine und Werkzeug für das Programmiermodell, Engine und Werkzeug für das
einfache Erstellen Workflow-basierter Windows-einfache Erstellen Workflow-basierter Windows-Anwendungen.Anwendungen.
Zentrale Workflow-Technologie für Zentrale Workflow-Technologie für
WindowsWindows
Teil des .Net Framework 3.0Teil des .Net Framework 3.0
Erweiterbares Programmiermodel Erweiterbares Programmiermodel
Workflow neu definiertWorkflow neu definiert
Workflow als Mainstream-TechnologieWorkflow als Mainstream-Technologie
Was ist ein Workflow?Was ist ein Workflow?Eine Zusammenstellung von Eine Zusammenstellung von Activities, Activities,
organisiert in einem organisiert in einem Flowchart oder StatusdiagrammFlowchart oder Statusdiagramm
AnManagerEskalieren Beispiel Activities…. Beispiel Activities…. CheckInventory
Wie ein Flowchart…. Wie ein Flowchart…. Oder einem Statusdiagramm…. Oder einem Statusdiagramm….
Workflow Scenario SpektrumWorkflow Scenario Spektrum
BeteiligteBeteiligte: Menschen, Rollen: Menschen, Rollen
Ablauf:Ablauf: Flexibel, dynamisch Flexibel, dynamisch
Daten:Daten: Unstrukturiert, Unstrukturiert, DokumenteDokumente
Beteiligte :Beteiligte : Apps, Services Apps, Services
Ablauf:Ablauf: Vorgeschrieben Vorgeschrieben
Daten:Daten: strukturiert, strukturiert, transaktionaltransaktionalInformation Worker
• Document Review…Information Worker• Document Review…
System WorkflowSystem WorkflowHuman WorkflowHuman
Workflow
Windows Workflow Foundation
Business to Business• Supply Chain Mgmt…Business to Business• Supply Chain Mgmt…
Line of Business AppsLine of Business AppsCRMERP
IT ManagementIT Management
.NET Developer.NET Developer
Software HerausforderungenSoftware Herausforderungen““Die echte Welt”Die echte Welt” Software HerausforderungSoftware Herausforderung
“Bestellungen müssen in 48 Stunden bestätigt
und in 30 Tagen versendet sein”
“Die meisten Lieferanten bestätigen unsere
Bestellung, manche vergessen es …”
“Was ist der Status der Bestellung? Was ist der
nächste Schritt?
Langlauffend und StatefulWorkflows laufen bis zu 30
Tage und müssen daher State verwalten
Flexible Control FlowFlexibilität in der
Workflowausführung. Schritte überspringen.
TransparenzDarstellung des Status
innerhalb der grafischen Workflowdarstellung
Workflow und BizTalk ServerWorkflow und BizTalk Server
• Premium BPM Server• Server product• Verwendent in B2B, EAI, BPM Szenarien• Verteilebare Lösung• Verwaltbarkeit, Scale-out
• Workflow Foundation• Bestandteil von .NET FW 3.0 • Weites Einsatzgebiet• Für Eigenentwicklung• Ermöglicht Verwaltbarkeit undScale-out Lösung.NET FW 3.0
Windows Workflow Foundation
Visual Studio Designer
Messaging
Design
Tools
Business
ActivityMonitor
AndAdminTools
Orchestration
Transformation
Adapters
BizTalk ServerAccelerators
Workflow
Workflow und Office 2007Workflow und Office 2007
SharePoint: Workflows starten, erstellen, dran teilnehmen, anpassen
Outlook: Benachrichtigungen empfangen
SharePoint Designer 2007: Workflows anpassen und erstellen
Word, PowerPoint, Excel, InfoPath: SharePoint Workflow starten, dran teilnehmen
AgendaAgenda
Was ist die Workflow Foundation?Was ist die Workflow Foundation?
Architektur & KernkonzepteArchitektur & Kernkonzepte
Workflow Engine & ServicesWorkflow Engine & Services
Windows Workflow FoundationWindows Workflow Foundation
KernkonzepteKernkonzepte
Activity
Visual DesignerVisual Designer
Workflows sind ein Set von ActivitiesWorkflows sind ein Set von Activities
Workflows laufen in einem Host Workflows laufen in einem Host ProcessProcessEntwickler können eigene Activity-Entwickler können eigene Activity-Bibliotheken erstellenBibliotheken erstellen
KomponentenKomponentenBase Activity Library:Base Activity Library: Out-of-box Out-of-box Activities und Basis für eigene ActivitiesActivities und Basis für eigene Activities
Runtime Engine:Runtime Engine: Workflow Execution Workflow Execution und State Managementund State Management
Runtime Services:Runtime Services: Hosting Hosting Flexibilität und KommunikationFlexibilität und Kommunikation
Visual Designer
Activity Library
Workflow Foundation
Base Activity Library
Runtime Services
Host
WF Runtime Engine
Workflow
Workflow BasicsWorkflow BasicsEin Workflow ist eine KlasseEin Workflow ist eine Klasse
Ein Workflow kann in XML beschrieben werdenEin Workflow kann in XML beschrieben werden
<?Mapping XmlNamespace="Activities" ClrNamespace="System.Workflow.Activities" Assembly="System.Workflow.Activities" ?>
<SequentialWorkflow x:Class="MyWorkflow" xmlns="Activities" xmlns:x="Definition"> …</SequentialWorkflow>
using System.Workflow.Activities;
public class Workflow1 : SequentialWorkflow{}
Workflow BasicsWorkflow BasicsWorkflow Constructor konfiguriert Workflow Constructor konfiguriert ActivitiesActivitiespublic partial class Workflow1 : SequentialWorkflow {
public Workflow1() {
InitializeComponent();}
}
public sealed partial class Workflow1 : SequentialWorkflow {private Delay delay1;private void InitializeComponent()
{this.delay1 = new System.Workflow.Activities.Delay();this.delay1.ID = “delay1";this.delay1.TimeoutDuration =
System.TimeSpan.Parse("00:00:05");this.Activities.Add(this.delay1);this.ID = "Workflow1";
}}
Workflow Workflow ErstellungsoptionenErstellungsoptionen
.NET assembly• ctor definiert
Workflow
Markup OnlyMarkup Only““Deklarativ”Deklarativ”
XOMLXOML
Markup undMarkup undCodeCode
C#/C#/VBVB
Nur CodeNur Code Generiert vonGeneriert vonAnwendungAnwendung
XOMLXOML C#/C#/VBVB
• XML definesXML definesworkflow structureworkflow structurelogic and data flowlogic and data flow
• XML definesXML definesworkflowworkflow• Code-beside Code-beside defines extra defines extra logic logic
• Code createsCode createsworkflowworkflowin constructorin constructor XOMLXOML C#/C#/
VBVB
App erstellt App erstellt ActivityActivityTree und Tree und serialisiertserialisiert
Workflow Compilerwfc.exe
C#/VB Compiler
Visual DesignerVisual DesignerWorkflow DesignersWorkflow Designers
Workflows erstellenWorkflows erstellenVisuelle und Code basierende Visuelle und Code basierende ProgrammierungProgrammierungVisuelles DebuggingVisuelles DebuggingThemes support Themes support Designer re-hostingDesigner re-hosting
Activity DesignerActivity Designer
Neue Activities erstellenNeue Activities erstellenVisuell und Code basierende Visuell und Code basierende ProgrammierungProgrammierungAbleiten von der Activity Ableiten von der Activity Basis- klasse oder ganz neu Basis- klasse oder ganz neu anfangen anfangen Activity Designer
Sequential Designer State Machine
Designer
Workflows erstellenWorkflows erstellen
Was sind Activities?Was sind Activities?
Ein Activity ist ein Schritt im WorkflowEin Activity ist ein Schritt im WorkflowHat Hat PropertiesProperties u undnd EventsEvents, die im Workflow –, die im Workflow –Code programmierbar sindCode programmierbar sindHat Hat MethodenMethoden, die nur die Workflow Runtime , die nur die Workflow Runtime aufruftaufruft
Vergleichbar mit Forms & ControlsVergleichbar mit Forms & ControlsActivity == ControlActivity == Control
Workflow == Form Workflow == Form
Activities fallen unter zwei KategorienActivities fallen unter zwei KategorienBasicBasic
CompositeComposite
Activities – Erweiterbarer Activities – Erweiterbarer AnsatzAnsatz
Base ActivityBase ActivityLibraryLibrary
Benutzerdefinierte Benutzerdefinierte Activity-LibrariesActivity-Libraries
EigeneActivity
Base Activity Library
Erweit. Activity
Compose Activities
Domain-spezifischeDomain-spezifischeWorkflow PaketeWorkflow Pakete
Compliance
RosettaNet
CRM
IT Mgmt
Flexible Control FlowFlexible Control Flow
Regel-gesteuerte Activities
Step2
Step1Rule1Rule1
Rule2Rule2
DataRegeln und Status der Daten bestimmen dieReihenfolge
•Daten-gesteuert•Einfache Abfragen, komplexe Regeln•Abhängige Activity-Gruppen
State Machine Workflow
State2
State1EventEvent
EventEvent
Externe Events steuern die Ausführungs-reihenfolge
•Reaktiv, Event-gesteuert•Überspringen/Wiederholen•Graphen Metaphor
Sequential Workflow
Step1
Step2
SequentielleStruktur beschreibtAusführungs-reihenfolge
•Vorhersehbar, formal•Automatisierung•Flowchart Metaphor
Activities verwenden und Activities verwenden und erstellenerstellen
Workflow LifecycleWorkflow LifecycleGesteuert via WorkflowInstanz Objekt Gesteuert via WorkflowInstanz Objekt
Lifecycle und Persistenz OperationenLifecycle und Persistenz OperationenAbort, Terminate, Suspend, ResumeAbort, Terminate, Suspend, Resume
Load, UnloadLoad, Unload
Operationen erzeugen zugerhörige Operationen erzeugen zugerhörige Workflow EventsWorkflow Events
private void TerminateButton_Click(object sender, EventArgs e){ WorkflowInstance workflowInstance =
workflowRuntime.GetWorkflow(Program.workflowInstanceId);
workflowInstance.Terminate("Terminating Case, Problem was resolved");
}
Workflow Runtime EventsWorkflow Runtime Events Workflow Instanz EventsWorkflow Instanz Events
Bietet die Möglichkeit Informationen über den Workflow-Bietet die Möglichkeit Informationen über den Workflow-Lifecycle der Instanz zu erhalten z.B.:Lifecycle der Instanz zu erhalten z.B.:Aborted, Terminated, Started, Completed, usw.Aborted, Terminated, Started, Completed, usw.
EventArgs enthält die InstanzID der zugehörigen EventArgs enthält die InstanzID der zugehörigen Workflow InstanzWorkflow Instanz
Erzeugt durch Workflow-Instanz Operationen oder Erzeugt durch Workflow-Instanz Operationen oder während der Ausführung während der Ausführung
z.B.: Die Ausführung der Terminate Activity erzeugt das z.B.: Die Ausführung der Terminate Activity erzeugt das WorkflowRuntime.WorkflowTerminated Event WorkflowRuntime.WorkflowTerminated Event
Workflow Runtime EventsWorkflow Runtime EventsBietet die Möglichkeit Informationen über die Workflow-Bietet die Möglichkeit Informationen über die Workflow-Runtime zu erhaltenRuntime zu erhalten
Started, StoppedStarted, Stopped
Workflow Events (I)Workflow Events (I)Workflow Event HandlersWorkflow Event Handlers DescriptionDescription Event ArgumentsEvent Arguments
ExceptionNotHandledExceptionNotHandled Thrown when the workflow Thrown when the workflow instance doesn’t handle the instance doesn’t handle the internal exceptioninternal exception
ExceptionNotHandledEventArgsExceptionNotHandledEventArgs
StartedStarted Thrown when the workflow Thrown when the workflow runtime is startedruntime is started
WorkflowRuntimeEventArgsWorkflowRuntimeEventArgs
StoppedStopped Thrown when the workflow Thrown when the workflow runtime is stoppedruntime is stopped
WorkflowRuntimeEventArgsWorkflowRuntimeEventArgs
WorkflowAbortedWorkflowAborted Thrown when the workflow Thrown when the workflow instance is abortedinstance is aborted
WorkflowEventArgsWorkflowEventArgs
WorkflowCompletedWorkflowCompleted Thrown when the workflow Thrown when the workflow instance is completedinstance is completed
WorkflowCompletedEventArgsWorkflowCompletedEventArgs
WorkflowCreatedWorkflowCreated Thrown when the workflow Thrown when the workflow instance is createdinstance is created
WorkflowEventArgsWorkflowEventArgs
WorkflowIdledWorkflowIdled Thrown when the workflow Thrown when the workflow instance is idle (ex. Delay or instance is idle (ex. Delay or EventSink)EventSink)
WorkflowEventArgsWorkflowEventArgs
WorkflowLoadedWorkflowLoaded Thrown when the workflow Thrown when the workflow instance is loaded into memory instance is loaded into memory (i.e. re-hydrated)(i.e. re-hydrated)
WorkflowEventArgsWorkflowEventArgs
Workflow Events (II)Workflow Events (II)
Workflow Event HandlersWorkflow Event Handlers DescriptionDescription Event ArgumentsEvent Arguments
WorkflowPersistedWorkflowPersisted Thrown when the workflow Thrown when the workflow instance is persistedinstance is persisted
WorkflowEventArgsWorkflowEventArgs
WorkflowResumedWorkflowResumed Thrown when the workflow Thrown when the workflow instance is resumed after being instance is resumed after being suspended.suspended.
WorkflowEventArgsWorkflowEventArgs
WorkflowShutdownWorkflowShutdown Thrown when the workflow Thrown when the workflow runtime is shutdownruntime is shutdown
WorkflowEventArgsWorkflowEventArgs
WorkflowSuspendedWorkflowSuspended Thrown when the workflow Thrown when the workflow instance is suspended by the instance is suspended by the runtimeruntime
WorkflowSuspendedEventArgsWorkflowSuspendedEventArgs
WorkflowTerminatedWorkflowTerminated Thrown when the workflow Thrown when the workflow instance is terminated by the instance is terminated by the runtime or internallyruntime or internally
WorkflowTerminatedEventArgsWorkflowTerminatedEventArgs
WorkflowUnloadedWorkflowUnloaded Thrown when the workflow Thrown when the workflow instance is un-loaded from instance is un-loaded from memory (i.e. Hydrated)memory (i.e. Hydrated)
WorkflowEventArgsWorkflowEventArgs
Workflow EventsWorkflow Events
Workflow und Host Workflow und Host KommunikationKommunikation
Kommunikation zwischen Workflow und Kommunikation zwischen Workflow und Host basiert auf Messaging mit Methoden Host basiert auf Messaging mit Methoden und Eventsund Events
Workflow und Host Kommunikation Workflow und Host Kommunikation (II)(II)
[ExternalDataExchange] public interface IApprovalService
{
void ManualApproval(int amount);
event EventHandler<ExternalDataEventArgs> ApprovedProposal;
event EventHandler<ExternalDataEventArgs> RejectedProposal;
}
//ExternalDataExchangeService in der Runtime registrieren
WorkflowRuntime workflowRuntime = new WorkflowRuntime()
ExternalDataExchangeService externalService = new ExternalDataExchangeService();
workflowRuntime.AddService(externalService);
externalService.AddService(new ApprovalService());
class ApprovalService : IApprovalService
{}
Workflow Host Workflow Host KommunikationKommunikation
AgendaAgenda
Was ist die Workflow Foundation?Was ist die Workflow Foundation?
Architektur & KernkonzepteArchitektur & Kernkonzepte
Workflow Engine & ServicesWorkflow Engine & Services
Runtime ServicesRuntime Services
Host Application
Out of Box Services unterstützen SQL Server/MSDE
Verwaltung von Threading und Transaktionen
PersistenceService lädt und speichert den Status der Instanz
TrackingService verwaltet Profile und speichert Tracking-Informationen
WF Runtime
Services
PersistenceService
TrackingService
SchedulerService
CommitWorkBatch Service
PersistencPersistenceeServiceService
Host Host ApplicationApplication
WorkflowWorkflowInstanceInstance
PersisPersistt
LoadLoad
UnloadUnload
Übersicht PersistenceÜbersicht Persistence
Persistieren der Status und Timer Information einer Workflow Instanz
Instanzen bleiben so lange Zeit verfügbar und belegen kein Speicher
Instanzen sind auch nach einem System Restart verfügbar
Workflow Persistence Workflow Persistence aktivierenaktivierenPersistence Support für Workflow InstanzenPersistence Support für Workflow Instanzen
Workflow Runtime erstellenWorkflow Runtime erstellen
Connection String definierenConnection String definieren
SqlPersistenceService in Runtime registrierenSqlPersistenceService in Runtime registrieren
Workflow startenWorkflow starten Laden und Entladen mit Laden und Entladen mit
StatePersistenceServiceStatePersistenceServiceprivate void StartCaseManagementProcess(){ WorkflowRuntime wr = new WorkflowRuntime(); string connectionstring = "Initial Catalog=Persistence;DataSource=localhost;Integrated Security=SSPI;"; wr.AddService(new SqlWorkflowPersistenceService(connectionstring)); WorkflowInstance instance = wr.CreateWorkflow(typeof(ManageCaseCreation)); instance.Start();}
Workflow PersistenceWorkflow Persistence
Übersicht TrackingÜbersicht TrackingNachhalten aller Statusänderungen und Daten im Nachhalten aller Statusänderungen und Daten im WorkflowWorkflow
ProfileProfileAPI’s für die ErstellungAPI’s für die Erstellung
XML legt fest, was nachgehalten wirdXML legt fest, was nachgehalten wird
Includes und Excludes, State Changes, Data Context, …Includes und Excludes, State Changes, Data Context, …
TrackingInformation Tracking
Service
Host Application
Activities
WorkflowInstance Query
WriteProfile
Workflow Tracking aktivierenWorkflow Tracking aktivierenTracking Unterstützung für Workflow InstanzenTracking Unterstützung für Workflow Instanzen
Tracking Profil(e) erstellenTracking Profil(e) erstellen
Workflow Runtime erstellenWorkflow Runtime erstellen
Connection String festlegenConnection String festlegen
Ein oder mehrere Tracking-Services bei der Engine Ein oder mehrere Tracking-Services bei der Engine registrierenregistrieren
Workflow erstellen und ausführenWorkflow erstellen und ausführen
Tracking Datenbank abfragen – Instanz und Activity Tracking Datenbank abfragen – Instanz und Activity InformationInformationprivate void StartCaseManagementProcess()
{ WorkflowRuntime wr = new WorkflowRuntime(); string connectionstring = "Initial Catalog=Persistence;DataSource=localhost;Integrated Security=SSPI;"; wr.AddService(new SqlTrackingService(connectionstring)); WorkflowInstance instance = wr.CreateWorkflow(typeof(ManageCaseCreation)); instance.Start();}
Workflow TrackingWorkflow Tracking
AgendaAgenda
Was ist die Workflow Foundation?Was ist die Workflow Foundation?
Architektur & KernkonzepteArchitektur & Kernkonzepte
Workflow Engine & ServicesWorkflow Engine & Services
ZusammenfassungZusammenfassungZentrale Workflow-Technologie für Zentrale Workflow-Technologie für WindowsWindows
Teil des .Net Framework 3.0Teil des .Net Framework 3.0
Erweiterbares Programmiermodel Erweiterbares Programmiermodel
BizTalk Server, Office 2007, MBS & andere BizTalk Server, Office 2007, MBS & andere Microsoft Client/Server Produkte, werden auf Microsoft Client/Server Produkte, werden auf WF basierenWF basieren
Workflow neu definiertWorkflow neu definiert
Technolgie für System & Human Workflow Technolgie für System & Human Workflow zentrische Anwendungenzentrische Anwendungen
Sequentieller oder „State machine“ WorklfowSequentieller oder „State machine“ Worklfow
Workflow als Mainstream-TechnologieWorkflow als Mainstream-Technologie
Erweiterbare Plattform für ISVsErweiterbare Plattform für ISVs
Weitere InformationenWeitere Informationen
MSDNMSDN®® Workflow Page Workflow PageMicrosoftMicrosoft®® Visual Studio Visual Studio®® ExtensionsExtensions
Download 12 Hands-on LabsDownload 12 Hands-on Labs
http://msdn.com/workflowhttp://msdn.com/workflow
Community SiteCommunity SiteRSS Feeds für News & RSS Feeds für News & UpdatesUpdates
Beispiele, Tools und Beispiele, Tools und Runtime-Runtime-ServicekomponentenServicekomponentenhttp://wf.netfx3.comhttp://wf.netfx3.com
ForenForenhttp://www.WindowsWorkflow.net/http://www.WindowsWorkflow.net/ForumsForums
Fragen und AntwortenFragen und Antworten
Vielen Dank!Vielen Dank!
Christian Binder Christian Binder
[email protected]@microsoft.com