VIII Call a remoting method. Call a remoting method asynchronously. Use events with remote objects. 1. 2. 3. A ) B ) Use a delegate to invoke a remoting method. 1. Check the state of completion and respond. 2. C ) Wire a Client to listen for remote events. 1. Method Invocations and Event Management with .NET Remoting
Complex to program. Easy-to-create and deploy. Ease-of-Programming Very extensible by allowing us to customize the different components of the .NET remoting framework. Provides extensibility by allowing us to intercept the SOAP messages during the serialization and de- serialization stages. Extensibility Can also take advantage of IIS for fault isolation. If IIS is not used, application needs to provide plumbing for ensuring the reliability of the application. Highly reliable , since it’s always hosted on IIS. Reliability Homogenous environment. Heterogeneous environments. Interoperability Using binary communication, .NET Remoting can provide support for rich type system Supports the data types defined in the XSD type system. Type System Stateful(Singleton), Stateless(SingleCall) Stateless Environment State Management TCP, HTTP, SMTP & etc HTTP Protocol .NET Remoting ASP.NET Web Services
An n-tier architecture using Enterprise Services (COM+)
<ul><li>The server must be contacted each time ; when a remote method is called . </li></ul>2) The developer cannot know at the time of invocation whether or not the method will complete successfully. 3) Remoting methods involve network traffic. Calling Remote Methods
Stateless Invocation Using One-Way Calls <ul><li>Namespace : </li></ul><ul><li>System.Runtime.Remoting.Messaging </li></ul><ul><li>Attribute : </li></ul><ul><li>One-Way </li></ul>The OneWay attribute can be used to provide fire and forget functionality.
Remote Methods -- Synchronous Potential Problems with Synchronous methods 1) Might end in an ERROR. 2) Might complete successfully , but take a long time to complete. 3) Waiting for each call to complete individually is potentially wasteful.
Delegates Objects which points towards a function which matches its signature. Its reference type used to encapsulate a method with a specific signature. Similar to function pointers in C++.
<ul><li>By creating a delegate with a matching signature, any method can be invoked by calling the delegate’s BeginInvoke method. </li></ul><ul><li>To use a delegate object to invoke a method, the delegate’s signature must match the signature of any method it will be used to invoke. </li></ul><ul><li>A delegate can be used to invoke different methods, but each method must have a matching return type and a matching parameter list. </li></ul>More About Delegates
Asynchronous An invocation that does not block processing from occurring (an asynchronous call does not block execution of the program while processing occurs). Synchronous A way to call a method that happens sequentially, in the order in which the method was called. If your program calls method A and then calls method B, method B is not called until method A returns. Callback An object that is sent to a method that will notify the caller when processing has completed. One-way Mechanism that allows client-side processing to continue irrespective of anything that happens on the server. Remote method A method that processes on a machine different from the one that called it. Fire and forget Initiating a call to a method and not retrieving any results back from it, even if the method throws an exception.