Presenter:Mike Taulty
Windows Communication Foundation in .NET Framework V3.5 has some new capabilities around easily building services which manage long-running conversations with clients. The new framework bits make it much easier to write services and clients which operate in a web farm, survive re-starts whilst maintaining a client conversation.
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 welcome to the short video on Windows education foundation in net framework version 3 5 and a feature called durable services might I told him I work in the developer and platform group in Microsoft in the UK and not never ever signify that this version of the net framework which will ship with visual studio 2008 and the idea of durable services in winner s communication foundation here is that you can allow the framework at view that in managing a conversation between client and services may last a long time so the idea here is that the client begins conversation with the service and service may well build a state on the half that clients conversation and the framework dramatically persists that 40 the framework also automatically send a token down to the client which identifies asset of state back at the service and
Minute 1
A conversation with services collected by the framework again automatically pull that that token from a message goes in indexes to find the state rehydrates the state and get your service go back and running with the state that it had the last time he was speaking to that particular line so associates doing automatic state management and passing backwards and forwards compensation tokens automatically members of the crime to the service can have a conversation this is done in her pluggable manner so the state management the persistence of their is something that is pluggable signal in different providers naturally as you d expect we have a sequel server based provider for implementation updates in the and 52 082 and have already built some of the bits and pieces here and specifically I have a website containing prebuilt web service I have a client of purposes and as has been the theme in a number of these winners communication foundation videos
Minute 2
The website and the World Service about displaying album art from the collection are stored under this contract so it is a look at the service of the giving of a theatre browsing service so essentially the idea is third you just want to browse the art of the albums in your CD collection to have this WTF interface which is how you build anything to be set he was stuck with interfaces so we consider we got it I row was interface without a vision of course so that is the reason of service contract and only got stand and members on here which really set their conversation in place so the idea is that initially the client will call get me the first album art and will return the data structure to them if we get older that data structures very simple you get an album name and the URL which point duty
Minute 3
Artwork that particular album so we got back to this interface we got the get first album and then we ve got to get next album art and a fund with the unethical done by your notice that we ve also attributes of the synthesis of new athletes comment on the final version 3 5 so this member here with attributes of his durable operation after the and whether we can or can t create an instance of the service in order to handle this particular operation now because of course this is supposed to start a conversation then we want to create his service in that case when we look at Ireland next method get the next album art began his durable operation but this time the same well the very idea of next means that we re not creating a new instances were coming into existing conversation and finally got this kind of dummy method vehicle done and all this is says is
Minute 4
Or when he finished with a conversation between these three man methods on this interface with finding a conversation start the continues here and complete here and you can call it as many times as you won in the way that the service will work is that when it falls off the end of the available art it wouldn t go back to the beginning of a self conscious hour that artwork again and only look at the service implementation here Tessa s Outlook of implementation essentially about this classical browse that implements interface you ll notice that the glass itself has been activated to say this is durable service and eventually the only important thing about the civilisation the only reason to showing it to you if it maintains two pieces of state it maintains which artists were up to assistant editor and it retains which album within the artists collection currently looking at on a per client basis and is just two entities that am
Minute 5
Obtained and the beauty of durable services is that I don t have to write any code whatsoever to get these things serialise for me the net framework is just going to do that for me so essentially all I have to do is put them onto my implementation farce and the framework will magically serialise these things for me and essential is that it is going to serialise after every operation complete so every time they have an operation on this thing was in happen and in my case he is doubtless greater incidence of my service class because that s my instantly model we re going to feed it any persistent statehouse to the client is making a particular call with an answer that call with serialise today and another to the object again naturally have is working severely one thing really about his son this class is that in order to do its job it maintains needs to values and in order to do that it does not write any code to make that happen all we ve done is said that this thing
Minute 6
Is a durable service in our course with an interface and implementation were hosting inside of IIS was that I deleted them figuration in order to make the beauty of work so let s take a look configuration file must pop into a web config as collateral this down as some expand some of our justice system service model portion is what we won to get in here I ve got a service is that Societa showed you it s listening after particular endpoint is using a new binding in net frame of urgency by five WSs to keep the contents binding it out in Islington or the World Service s stuff so the security model and thing but it also brings in context and context is everything is the way in which the client is sent an identifier token of July
Minute 7
Them clearly find a whole state of the client even though we soon realised it was me some tokens will get back to that state of the point in the future and it s these contextual bindings this is not the only one around as a TCP version as well it is contextual bindings and know how to transmit that token up and down the plea that communications stack now were considering that in our case were not reconfiguring a very in a very fancy way to have a good service and consideration here you can see there is real advertising meta database and debugging but the most importantly serious that we are using a persistence provider and is this thing is going to make neat serialisation work for us so in our case were using a built in and persistence provider is the sequel server persistence provider easy connection strings only pointed to the connection string which is also defined in the configuration file
Minute 8
As you can see some semantics around how long should be able to lock a piece of state and so on with them within the database now if you don t want you sequel server here you can go ahead and implement your own persistence provider and then club back into the framework so we have one that we ship or even on plug in if you want a different support so the only other piece of configurations of this service eyebrows arch service beyond its persistence provider is that if you can figure down here configuring that of US 63 converts binding and all I ve done their research of security because of this particular scenario are not interested in security so with all that implies a better service is advertising that the data I used that methylated to help rebuild a point against service so if it are over to the client have added a service reference to that thing am just using the dialogue reinvestigation of the service reference to let go ahead and
Minute 9
Close a few windows and will run the crime judged on the spin that up it at the time comes up and it starts going truly our runs and the pictures I actually put into the Stauffer s particular example on with the next way through these is vital in order as said in a previous video these are not all of Bob Dylan s albums because I only cut in the first 10 or so and there was an awful lot of downloading to go to every album yet released and what your spot is the only acid in the popular move on to Bruce Springsteen and his albums are coming in order fan if we stop at this point here that I happen to know that the next album should be done while the innocent and eastern shuttle and if we were to shut this kind down now you see that it says the once safe state it was a yes in the kind that has persisted that token that the service can it and if we go back and run at the client again
Minute 10
What was says a client will call and ask for the next piece of album from the position where it was the last time we ran it to taxi remembering where it was in a sequence and you can see the decline s comeback and it has started at the beginning of the sequence is medical to get the next piece of art and it so happens as you say after Greece is rationed by New Jersey and an exclusive album is the wildest Indonesian shuffle and a protein of the net from sponsor and but the point of this is not as that Springsteen is an album history the point is that the client remembered where it is up to a colder service and asked for the next and entry and the service rehydrated state and based on what the client centres of them at the right piece of data so it s a look at the Clydesdale such as the own or telephone not to say states are now on what s going on on the client Summers s Outlook of
Minute 11
Code of into the coded so when this form am the first runs up a coldest method loafers picture and the first thing that method does is create an instant of the proxy to the service of this is just the proxy class I got from adding a service reference and we keep this around the duration of decline to this missing he was out in the variable of this class and history situations at men s application comes up either you are halfway through a conversation he want to continue on your not and if you are halfway through the conversation you will have a complex token for that conversation persisted on the disc because that s what the reform doesn t want me closer to what we do is use a little helper class to see if we ve got a complex token on the disc on if we don t have one then we could call get first album is with starting a conversation if we do have one of these things and what we do it is a use in the middle of WTF
Minute 12
Actinic to reach into the proxy and get a thing called a complex manager and use that to set the context on the proxy giving the token were loaded from the disc so this is essentially way of setting up the right token is such that we can continue the conversation that we were having previously and I recall get next album that s on to send the context up into the service of services and dehydrate the state that context opens with a pass back the right result and only put the things on screen and when the combat from the service naturally when you call get next picture on screen we just call the next method on the proxy and put the bits onto the screen is that simple enough and then finally an when the form is closing as he saw Maiziere with a message for St John to save if you say no will use a helper method to delete any previously staid and stored conversation to and from the disc just incase we with a
Minute 13
At lying around in Scottsdale now where is if you say that you do want to save the current state of the conversation and once again we reach in using the WC of magic to get the context manager from the proxy you hold of that famed and we ask if the current context the context token that identifies a conversation were having that servers and again in my case at issue is a persistence method and help the class to store out of this salary literally those methods that don t appear to be magical complicated essentially all that is happening is this method you look context all it s doing in its using some standard serialisation view to deserialise one of the sanctions from the disc so fundamentally context token is a bunch of names and strings dictionary of names and strings and so does nothing complex about its just property back and you are doing is seeing everybody
Minute 14
On our disc if we have bring it back of course than assist context takes the property bag and persists it and delete concept simply make sure that we delete the file that will use its store that and so is nothing magical and and there is just put into a separate class to move it out of the main code as a budget so and essentially our client he is beginning the conversation or continuing a conversation depending on whether Scott persisted token on the disc on and is once again a system response to backline of a so we run up the clarity of the first time it has no persisted state so called service asking from the first picture will recall press next goes on cause of the next picture and bear in mind that context open will be propagated in service with
Minute 15
Dehydrate the state and would do the right thing based on a state of this particular client and then if we were to shut down the application it talks to the proxy if we quit yet if the total proxy to grab that context open us over the disc and then the next time we run it up longer starting from the beginning any more because the application will load the context open from the disc inserted into the proxy that proxy was in the service to service will continue the previous conversation that we were having with it and we carry on to we jump into the middle of an interaction and carry on from where we were before so this is just a really nice easy way that week and estate management on the service I am without having to write a bunch code ourselves and persistence framework is already there is important to say that I m on the service either using net serialisation in a civilised son those member states have
Minute 16
Actual service just the second you remember there are service had these two things will eventually were using binary civilisation to serialise those things into the database and we saw that you plug in a provider in the configuration file and of course you can build one of your toilet a nice way of maintaining and a conversation and some state on the server side to the client without having to write any of your own explicit code in order to make that happen just to summarise what was seen here the DCF in the final version 2 5 has courts of these durable services the idea is that clients and servers have a conversation during the course of that conversation that the service may well build up some state and the framework can automatically persist that state for the service here in order that obviously the service could be restarted until their back on state
Minute 17
And can get back to the States the particular conversation are having a crime we say that the persistent is automatically after writing the code to make that the sisters happen it pluggable provider we have a sequel server and plantations of this and then the token that needs to flow from this service back to the client in the first instance and then between the client and the service to continue the conversation that token is automatically propagated for a figure have to do anything to get that token to flow as it happens that open is either propagated by and HTTP cookie or if you are working on this hopeful world then difficult of soap that you get a control and that propagated on depending on your transport of your message for her and there are some bindings in the framework and didn t already know how to propagate this contest of combatants and four is specifically that of US HTTP content finding and figures also net become
Minute 18
Binding that already know how to move this context of combatants and forwards for you and in order to make that that happen now is your more information on this topic I recommend going into your MSDN documentation there is a topic and there called creating workflow services and durable services and assess part of the Windows workflow foundation documentation and this figure documentation to find the information you want and there is nothing to say about that you might be thinking why is this a topic under creating workflow services and durable services wise and within the BCF and it s important to realise that one great way of being able to build services that work in a long running manner with some extra capabilities beyond what we can do with this durable services is to use Windows workflow foundation to workflow foundation in net 2 5 is a great way of building the BCF services that have long running capabilities and a whole bunch more capabilities so I recommend you look a worthless
Minute 19
Says animal like a video around how you build services with workflow I am at a later point if you digresses specifically on this video then feel free to mail me my e mail address is just there on the screen and other now 24 listening at the final session useful and hope to catch up with you either electronically via one of the sessions in the future or perhaps it is an investment in
Click here to go to original video page
Monday, July 21, 2008
Video: Durable Services with WCF V3.5
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment