Google Search

Google
 

Wednesday, July 23, 2008

Video: Windows Workflow Foundation: Correlation

Presenter:Mike Taulty

Workflow Foundation has automatic capabilities for correlating messages that leave a Workflow instance with messages that are received by that same instance, making message exchange easier to deal with. In this session we'll look at how that's achieved.

The following text is a software generated transcript of the video. Click on a minute link to jump to a location within the video


Minute 0

Oh and welcomed the start and end of the session it s one in a series of short sessions or is then 10 minutes or so looking at everything is into visual studio net framework minus Mike told me I work in the developer and platform group in Microsoft in the UK and this is one of a series of sessions about the rumours were for evaluation it is a technology that is coming is part of version 3 01 of the net framework that is slated to ship this year and 2006 will release Windows Mr Annan will also release for Windows XP service Pack 2 and Windows server 2003 and workflow foundation is a technology for building workflow capabilities into your own applications at the session is at a slightly more recent terret topic in previous sessions and feel free to go watch those things before you watch this one we talked about how workflows can communicate with the host environment does they were forced to send off a message on a motorway form to come back in users host environment to do that

Minute 1

In the outside world through the local communications service as finally all works brilliantly however as a topic struck about in terms of how you correlate outgoing messages to incoming responses and sometimes as can be quite important gates are nearly visual studio 2005 I ve got net framework version 3 0 beta two I ve just downloaded and off the web and installed it and have also got the tools support for building workflows with net framework 2 0 beta two I ve already built a workflow and a little hosting environment around it the way I got here was through the standard file new project and I went ahead and began a sequential workflow console applications was just a console that we ve got our just one workflow that will show you are only doing this workflow leaders who look at this level was brought down in the second is that we have some parallel activity and

Minute 2

After that we discover console but we d like and as legislature with keeping the life little while so the parallel activity what it does is it had three different sequences and a 31 there is buying off getting a colour anonymity is that colour to write the text of the console she conceded in three ways of parallel activity we go out and we get a red collar and green colour and yellow and we do some writing to the console that those colours to what Anthony doing here with an these activities is we are calling out to host environment to get some information as a certain previous sessions that is used that when we do that is through this call external method activity this goes out on calls to host environment and the way that has modelled is that we supply an interface so if we look at this particular show Peel s forerunner you continually got an interface is called I request collar

Minute 3

Method on a cold request colour and we pass a parameter of the collar that we want in this case were passing red here clearly it will be passing green and clearly it will be passing the other two are going out three times to our hosts give me a colour the idea is the provider Cullinane welcomes back is a natural console colour real object that we can use to set terms collar and then write and test the console s is a duty rate in the wake of the host come back and say here is red and perhaps that only makes sense to show the interface is working as it is going to interfaces in you can deliver interface here I request colour it is an external data exchange in the face and thought about this previously for doing host communication with all request colour giving a Cullinane and when that colour is available which could be any time later on this event will fire back into workflow and the collar available event arcs

Minute 4

Will give us to pieces of information real console colour and the name of a Consul colour know this is a duplication as we asked for it in the first place because he lives in a trial that welcomes back to us tobacco however here we call over red we presumably get red and it will rigorously enter a little synchronisation complex this is so that his T shirt shall exceed you together has released it as will these two because when a parallel activity here we gained a Consul colour to red in the face of coat so fences here we soon make the colour and the red colour comebacks than a second and then if I had arrived at a text saying there should be an red should be in green and so on and so forth such as go back to that Fazackerley wafer red must look at the properties you notice all the venues will use in that event but then what we ve got is whereby

Minute 5

In the event data that comes then for that particular event into a variable called red colour available similarly when we go green were binding that it has been a property window back into green in colour available and similarly when we go yellow we go yellow colour available so we have underclass behind this workflow three different properties yellow colour available of tight colour available event arms similes green similarly to read so each one of these different facility light get red white red of setting one variable get Greenway Green setting another variable get yellow where yellow is setting another variable but they re all at the same time there are all of the colour available event to handle that particular event that comes back from the host writes a lot of exclamation little on the implementation of the service

Minute 6

The influence this interface sorry this interface then sits between the workflow and his host with a look that in the event of invasion of that interface to what we do and so they asked us for a particular colour we go ahead and use the net thread pool to delay this piece of work for a little while and essentially what we do is we delay them for a shorter period of time each time we are asked to come in and we delay from little while and then we construct a colour available event looks and we fire that event into the workflow to one leading as one of his going on here will essentially what I m doing and making sure that the yellow request is the first one to complete the green one will be the second want to complete and the red one with the third want to complete one reversing the order in which the eventual comeback to win the workflow we ask red green yellow from the host will get yellow green red

Minute 7

Italy would still like the right colours to shop in the right place just as you are not applying any tricks living on the good actual program you will find in our programme we create the workflow runtime we had an external data exchange service into night as we done in previous sessions at Guardian and the runtime and we had implementation into that particular service before we start any work such so it is all done if we go ahead along this workflow interesting in the sense that when we run a what we should see is some man relatively longer delays were as the messages come back notice that the text it should be raising reading the taxes should be green and yellow on the tax that should be a Jenrette what s happening at well essentially if we look back at the workflow with and out of the house saying giving a colour

Minute 8

Is to be read now giving a long green and given another one yellow and we all know that our hosts quite perversely in this case but it s meant to model a real scenario responds with yellow first then green then read to what is happening is the house has no way of this ambiguity and these three different events from these three different way it doesn t know this radio is the green and a dozen others waited yellow my nose that is the way it is that they re all for the same kind of thing is what is happening is events are being delivered to effectively the wrong shapes and cards from the workflow runtime and from our hosts perspective that s actually what we has to do we didn t say in any way shape or form that there was anything special about this way but is this weight but is this weight and there is something special about were for instance it has a unique identifier on to events will get delivered into the right work for instance that s fine but

Minute 9

As notice ambiguity between these two shapes and so we can pretty much deliver any of our three offence to any of these three shapes allows why we get the wrong results in this care and all of that description introduces the idea of correlation which is the sometimes when you send the message out of a workflow you need to tie up the message that comes back in our case we absolutely need to do this the fact that it s a yellow message coming in into Moscow to the chef here in the red message must go here and a green one Moscow there we can t accept an arbitrary message me to look at more information than just a workflow instance ID in order to correlate the message that we sent out with the message that we get back another correlation is using forages for a workflow after such a long description that is undoubtedly relatively easy to make this work if we go back to interface definition

Minute 10

What we can do on interface here we can start to tell the workflow runtime some more information to tell it that is not good enough just to deliver this to a specific into it also has delivered to a specific waiting activity to overdo it is like to use the new attribute you got correlation parameter and estate strain of a parameter several hours this is the colour and name a notice of this is a browse of this method here and what they did is regard to say that when this method is called by the workflow it begins a conversation with the host and that conversation can be followed colour is usually correlated using this particular parameter value here is what I say here is that this method call from the workflow to the host initialises correlation

Minute 11

And as when we were so close to the host when the host that she gets a colour wants to delivery back to the workflow is going to use this event here so I have to do is tell us where this thing here shows up in this event data to all readers go out and say we have a correlation alias and the value of a previously called Cullinane exists in this event data under a property called Cullinane and that s just tying up to the sky here so essentially what the saying is as this message goes out To this value and when one of these comes back making matchup may be as much at what was that they re in and that is the correlation now because they change the nature of this interface and provisionally vital build and pop back to my workflow and vinegar bunch of them errors around his activities could have changed the nature of them we can fix there is little of the properties on this note is a new property a

Minute 12

ish and told him essentially what we need to do is pair up these her external calls on the way to responses to and Lavinia s visit and an MSc one I want to scope it to that activity who lives in which a sequence one a degree in here will say that seek to and will scope it to that same well rather its own sequence activity and apparently value which is a yellow card seamer Alan and medical axes three and will go ahead likely to an activity that if we can patch up these three weights that we ve got here forget their properties sold everyone for the same sort of problem that we have the fourth patching them up in silly compactness runner up conventions go okay a

Minute 13

Own having change that interface definition rebuild at present five note is that it were getting colours the way we expect them to be so we haven t changed anything in the way that the events have delivered the event are still delivered in the wrong order as far as the workflow instances expecting them or us only in a way that asks for them but the workflow runtime is now doing some clever stuff for us to say well this is an event to the colour green and I know that this needs to go to is an activity which is waiting for the colour green similarly the red and yellow and which have unable that just a rehash is simply by going to data exchange interface that we already have an Italian workflow runtime that there is some more information going around this can

Minute 14

Location between the workflow and a host that it needs to use in order to route events to the right activities within a workflow so at a sense it has run into it again that this property here this parameter hint he s right word is a correlation piece of information this method initialises the conversation this event completes the conversation in here s station that the and that is how the runtime is able to do some more work for us and make sure that in scenarios like this one here that the right event was back to the right waiting activity that is to finish up its important to say that you don t always need to do this kind of correlation if you only had am one particular activity waiting to a particular kind of event in your workflow instance that it wouldn t matter because the workflow is already got a unique identifier in the event would get back to the right shape but in this circumstance were waiting to three events are of the same type

Minute 15

We need to go a little bit further to make sure they get delivered to the right place just a summer resort near correlation is about time together outgoing and incoming messages you send a message out to a trading partner you might receive 5000 messages in the meantime you need to know which one of them is that you from a trading partner so it s about having something that goes out in the outgoing data that you can match up with things coming in on the incoming data to make the relationship cleaners to pieces of theatre as a voice say that even if you are using local communications to communicate between the workflow instance and the host and vice versa you don t necessarily need correlation we just talked about in the second ago work it if you are just doing a simple sort of event out to the host and back again and your unique identifier few instances enough that he only to go down this route you have this extra translation and finally it has uncovered a local communications

Minute 16

This will be seen as in previous sessions are communicated to and from the workflow and the host and we saw that we adds an extra attributes to tell the wrong time what it is we want and it very nicely goes ahead and is arriving for it so it you are to get more information on workflow and the net framework version 3 bears an amnesty and developer Centre is a great place to check out and makes there on the screen such as Amnesty and the Microsoft com net framework and I will provide you to links to the 3 0 version and the current 2 0 version of a framework there is a dedicated site to got the phone at 3 0 and that is at www Fxthree com and his information at their about presentation and communication workflow and Windows car spaces and identity management is so those of us information on that site and then it is only specifically what follow up only saw in a session you re free to mail me unjust and told to Microsoft com as it is there on the screen

Minute 17

Other than that makes love listening and hoped the

Click here to go to original video page

No comments: