Your SlideShare is downloading. ×
Indigo Training
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Indigo Training

652
views

Published on

http://www.Intertech.com …

http://www.Intertech.com

This presentation was a pre-release talk on what became WCF.

Published in: Technology

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
652
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
7
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Objectives Review the role and motivations of Indigo Why the drastic change – again? Survey the Indigo architecture Draw parallels to current technologies Look at some Indigo code In the end, that's what its all about right? See how to prepare for Indigo today Because your projects are not on Microsoft's release schedule Copyright © Intertech Training 2004 • www.intertechtraining.com • 800-966-9884 • Slide 2
  • 2. Disclaimer!! Indigo is NOT a finished product! – When released, it will likely look different from what you see today Take all code examples with a big grain of salt – The specifics will change (attribute names, namespace names, etc) – However, the examples do provide a taste of what programming Indigo will be like Copyright © Intertech Training 2004 • www.intertechtraining.com • 800-966-9884 • Slide 3
  • 3. What is Indigo? Indigo is – A set of services for building distributed applications in .NET – A unified programming model to supersede Remoting, Web services, Enterprise Services, and MSMQ Indigo will ship – As part of the WinFx release (includes Avalon) – With Longhorn Indigo will run on – Windows XP – Windows 2003 – Windows quot;Longhornquot; Copyright © Intertech Training 2004 • www.intertechtraining.com • 800-966-9884 • Slide 4
  • 4. Why Do We Need Indigo? Too many sides of distributed .NET programming: – Remoting: RPC style, distributed objects, CLR type fidelity, code integration – Web Services: RPC style, XSD type fidelity, schema/WSDL integration – Enterprise Services: RPC style, code integration, declarative services (transactions, pooling, concurrency) – MSMQ: message style, schema or code integration, robust messaging support (guaranteed delivery, transacted messages) Result: Confusion reigns! – Questions regarding what to use when – Not easy to rewrite app if you start down the wrong path Copyright © Intertech Training 2004 • www.intertechtraining.com • 800-966-9884 • Slide 5
  • 5. Why Do We Need Indigo? Distributed objects are passé – OO dogma destroys distributed application performance and scalability Chatty versus Chunky interfaces Stateful versus stateless objects – Typically, nodes must share code in order to interoperate – OO proves to be an ineffective metaphor for distributed apps on an enterprise scale Service Oriented Architecture (SOA) is hip – But current tools favor RPC/distributed objects over SOA – Indigo provides tools to make service orientation easy But also supports RPC/Distributed Objects! Copyright © Intertech Training 2004 • www.intertechtraining.com • 800-966-9884 • Slide 6
  • 6. What is SOA? SOA is prescriptive guidance for building quot;connectedquot; applications The four principles of SOA: – Boundaries are explicit Contrast to quot;location transparencyquot; – Services are autonomous Atomic deployment is a myth – Services share schema and contracts Contrast to sharing DLLs – Service compatibility is based on policy Compatibility goes beyond schema and contracts Copyright © Intertech Training 2004 • www.intertechtraining.com • 800-966-9884 • Slide 7
  • 7. What is SOA? SOA characteristics – Nodes communicate through structured messages – Uses standard message formats (SOAP, WS-*) and wire protocols (HTTP, TCP, SMTP) – Achieves platform interoperability – Nodes are deployed independently and evolve independently – Not confined to request/reply semantics (like HTTP) Indigo supports SOA development, but also: – Can support RPC style communication ala Remoting – Can support pure messaging ala MSMQ Copyright © Intertech Training 2004 • www.intertechtraining.com • 800-966-9884 • Slide 8
  • 8. Indigo Architecture Indigo is split into 2 layers – The Connector layer exposes a low level programming model – The Services model is the quot;productivity sweet spotquot; Service Model Service Model High level High level Declarative Declarative Declarative Service Service ServiceMethod ServiceMethod Declarative Behaviors Behaviors Message or RPC Message or RPC Connector Layer Connector Layer Low Level Low Level Ports Channels Messages Extensible Extensible Ports Channels Messages Message Oriented Message Oriented Copyright © Intertech Training 2004 • www.intertechtraining.com • 800-966-9884 • Slide 9
  • 9. Indigo – Connector Layer The Connector layer exposes 3 main objects: – A Port represents a URL named location in network space – A Message represents a SOAP message in memory – A Channel provides message I/O through the Port Client AppDomain Client AppDomain Sending Sending Channel Channel Transport Channel Channel Transport Port Port Code Code 11 NN Channel Channel Message Server AppDomain Server AppDomain Receiving Receiving Channel Channel Transport Channel Channel Transport Port Port Code Code NN 11 Channel Channel Copyright © Intertech Training 2004 • www.intertechtraining.com • 800-966-9884 • Slide 10
  • 10. Indigo – Connector Layer Ports – Establish a base address for your service – Create the necessary channels for message I/O Channels – Define the message interchange patterns (Simplex, Duplex, Request/Reply) – Define policy requirements: security, reliability, transactions – Implement a pull mechanism for retrieving messages Copyright © Intertech Training 2004 • www.intertechtraining.com • 800-966-9884 • Slide 11
  • 11. Indigo – Connector Layer Messages – Represent a SOAP message in memory – Store and provide access to headers in memory – Provide access to the body via System.Xml types (XmlReader, XmlBinaryReader) – Message body may be streamed Copyright © Intertech Training 2004 • www.intertechtraining.com • 800-966-9884 • Slide 12
  • 12. Indigo – The Service Model The Service model is the layer most will use – The Connector layer is for plumbers The Service model – Extends the connector layer – Unifies Web services, Remoting, Enterprise Services into one programming model – Integrates with the CLR type system and supports schema/contract generation (WSDL) – Allows both message style and RPC style communication – Provides currency, instance, and session management – Is relatively lightweight (pay-as-you-go mechanism) Copyright © Intertech Training 2004 • www.intertechtraining.com • 800-966-9884 • Slide 13
  • 13. Indigo – The Service Model Client AppDomain Client AppDomain Proxy Proxy Calling Calling Service Extensions Service Extensions channel.Send() Code Code channel.Send() Channel Channel Transport Channel Channel Transport Port Port 11 NN Channel Channel Message Server AppDomain Server AppDomain Channel Channel Transport Channel Channel Transport Port Port NN 11 Channel Channel Session Session Service Extensions Service Extensions Service Service channel.Receive() channel.Receive() Copyright © Intertech Training 2004 • www.intertechtraining.com • 800-966-9884 • Slide 14
  • 14. Indigo – Service Model Named Params Named Params [Service] InteropMode InteropMode CommonAssemblies public class SimpleMath CommonAssemblies { [ServiceMethod] private int Add(int n1, int n2) { return n1 + n2; } public int Subtract(int n1, int n2) { return n1 - n2; } } Same as [Service], [ServiceContract] Same as [Service], except can only be public interface ISimpleMath except can only be { applied to interfaces applied to interfaces [ServiceMethod] int Add(int n1, int n2); } Copyright © Intertech Training 2004 • www.intertechtraining.com • 800-966-9884 • Slide 15
  • 15. Indigo – Service Model [Service] public class SimpleMath { Service model parses Service model parses [ServiceMethod] the message for the the message for the private int Add(int n1, int n2) method params method params { return n1 + n2; } Or use (Message m) Or use (Message m) [ServiceMethod] signature to work on signature to work on public int Subtract(Message m) the raw message the raw message { ... } [ServiceMethod] public Message Multiply(Message m) { ... } Oneway property Oneway property [ServiceMethod(Oneway = true)] declares that a declares that a private void FireAndForget() request/reply request/reply { ... } channel is not needed channel is not needed } Copyright © Intertech Training 2004 • www.intertechtraining.com • 800-966-9884 • Slide 16
  • 16. Indigo – Service Model Indigo also provides the RemoteObject attribute – Provides functionality similar to .NET remoting – Use to port .NET Remoting code to use the Indigo messaging layer – WSDL generation is not supported (requires assembly sharing) – Public visibility defines the remote contract [RemoteObject] public class RemoteMath : MarshalByRefObject { public int Add(int n1, int n2) {} } Copyright © Intertech Training 2004 • www.intertechtraining.com • 800-966-9884 • Slide 17
  • 17. Indigo – Hosting You can host Indigo services in any Windows exe However, ASP.NET is the typical hosting choice – Provides additional services: automatic startup, health monitoring, management – Supports a variety of network protocols: HTTP, TCP/IP – Other hosts require explicit creation of a Port and/or adding a service to the ServiceManager Copyright © Intertech Training 2004 • www.intertechtraining.com • 800-966-9884 • Slide 18
  • 18. Indigo – Transactions .NET 2.0 bakes an imperative transaction model – Goal: make transactional programming ubiquitous – For example: use a transaction to update an ArrayList – Defines a set of interfaces and services to make it easier to build custom RMs Transactions are an important part of Indigo – quot;Services are autonomousquot; assumes reliability and correctness – Indigo extends the imperative model with a declarative model (ala COM+) Copyright © Intertech Training 2004 • www.intertechtraining.com • 800-966-9884 • Slide 19
  • 19. Indigo – Transactions System.Transactions System.Transactions TransactionAttribute TransactionAttribute Indigo TransactionScope TransactionScope ITransaction ITransaction .NET 2.0 Lightweight Transaction Manager Lightweight Transaction Manager Kernel Tx Kernel Tx Only participates Distributed Tx Distributed Tx Coordinator Coordinator when needed Coordinator Coordinator (Longhorn) (Longhorn) Copyright © Intertech Training 2004 • www.intertechtraining.com • 800-966-9884 • Slide 20
  • 20. Manual Transactions in .NET 2.0 static void Main() { ICommittableTransaction cTx = Transaction.Create(); Transaction.Current = cTx.Clone(); Clone() returns a non- cTx.Commit(); committable Tx object } Subordinates can use this quot;ambientquot; Tx to enlist. This automatically flows through the AppDomain (think Call Context). Does not flow across Web service boundaries. Copyright © Intertech Training 2004 • www.intertechtraining.com • 800-966-9884 • Slide 21
  • 21. Implicit Transactions in .NET 2.0 static void Main() { using(TransactionScope ts = new TransactionScope(TransactionScopeOptions.Required)) { DoSubordinateWork(); // Do work on a transacted resource ts.Consistent = true; } } static void DoSubordinateWork() { using(TransactionScope ts = new TransactionScope(TransactionScopeOptions.Supported)) { // do work on a transacted resource ... ts.Consistent = true; } } Copyright © Intertech Training 2004 • www.intertechtraining.com • 800-966-9884 • Slide 22
  • 22. Indigo – Declarative Transactions Indigo adds declarative Tx attributes – Similar to Enterprise Services – Can apply to any Service method – Service model establishes the ambient transaction Indigo automatically propagates Tx Copyright © Intertech Training 2004 • www.intertechtraining.com • 800-966-9884 • Slide 23
  • 23. Moving to Indigo All your current code will run after you install Indigo – Current protocol stacks can be loaded in the same app domain as Indigo stack – Therefore: Remoting, Web services, and Enterprise Services, etc. will just work with no code updates The 2 questions really are: – Will my remoting/Web services/Enterprise Services/MSMQ based code interop with Indigo services? – How much code do I change to migrate to the Indigo protocol stack? Copyright © Intertech Training 2004 • www.intertechtraining.com • 800-966-9884 • Slide 24
  • 24. Moving to Indigo Interop with Technology Migration Path? Indigo? ASMX (Web services) Yes Simple WSE Yes Non-trivial Enterprise Services Yes Simple Remoting No Simple System.Messaging Yes Non-trivial Copyright © Intertech Training 2004 • www.intertechtraining.com • 800-966-9884 • Slide 25
  • 25. ASMX To Indigo: Service Code using System.Web.WebServices; public class SimpleMath : WebService { [WebMethod] public int Add(int n1, int n2) { return n1 + n2; } } using System.ServiceModel [Service] public class SimpleMath { [ServiceMethod] public int Add(int n1, int n2) { return n1 + n2; } } Copyright © Intertech Training 2004 • www.intertechtraining.com • 800-966-9884 • Slide 26
  • 26. ASMX To Indigo: Client Code public class MathClient { static void Main() { SimpleMath math = new SimpleMath(); int result = math.Add(5, 2); } } using System.ServiceModel; public class MathClient { static void Main() { SimpleMath math = ServiceManager.CreateProxy<SimpleMath>(); int result = math.Add(5, 2); } } Copyright © Intertech Training 2004 • www.intertechtraining.com • 800-966-9884 • Slide 27
  • 27. ASMX To Indigo: Notes SOAP Extensions will be easy to rewrite Full support for [WebMethod] and XML serialization attributes Avoid or abstract calls to HttpContext ASMX WSDL customization features not supported Copyright © Intertech Training 2004 • www.intertechtraining.com • 800-966-9884 • Slide 28
  • 28. .NET Remoting To Indigo: Object Code public class SimpleMath : MarshalByRefObject { public int Add(int n1, int n2) { return n1 + n2; } } using System.ServiceModel; [RemoteObject] public class SimpleMath : MarshalByRefObject { public int Add(int n1, int n2) { return n1 + n2; } } Copyright © Intertech Training 2004 • www.intertechtraining.com • 800-966-9884 • Slide 29
  • 29. .NET Remoting To Indigo: Host code using System.Runtime.Remoting; public class Host { static void Main() { RemotingConfiguration.Configure(quot;remote.configquot;); Console.WriteLine(quot;Waiting for client requests ...quot;); Console.ReadLine(); } } using System.ServiceModel; public class Host { static void Main() { ServiceManager svcMgr = new ServiceManager(quot;http://localhostquot;); svcMgr.Services.Add(quot;/SimpleMathquot;, typeof(SimpleMath)); Console.WriteLine(quot;Waiting for client requests ...quot;); Console.ReadLine(); } } Copyright © Intertech Training 2004 • www.intertechtraining.com • 800-966-9884 • Slide 30
  • 30. .NET Remoting To Indigo: Client Code using System.Runtime.Remoting; public class Client { static void Main() { RemotingConfiguration.Configure(quot;remote.configquot;); SimpleMath math = new SimpleMath(); int result = math.Add(5, 2); } } using System.ServiceModel; public class Client { static void Main() { SimpleMath math = ServiceManager.CreateProxy<SimpleMath>(); int result = math.Add(5, 2); } } Copyright © Intertech Training 2004 • www.intertechtraining.com • 800-966-9884 • Slide 31
  • 31. .NET Remoting to Indigo: Notes quot;Transparentquot; remoting supported except for quot;newquot; Remoting extension points (Channels, Sinks) not supported – You may no longer need the custom code because the feature is provided by Indigo (e.g. security) – Indigo provides its own extensibility points via the Channel and ServiceModel .NET 2.0 deprecates custom context interception Copyright © Intertech Training 2004 • www.intertechtraining.com • 800-966-9884 • Slide 32
  • 32. ES To Indigo: Object Code using System.EnterpriseServices; [ComponentAccessControl] [Transaction(TransactionOption.Required)] public class SimpleMath : ServicedComponent { [AutoComplete] [SecurityRole(quot;Managerquot;)] public int Add(int n1, int n2) {} } using System.ServiceModel; [Service] public class SimpleMath { [ServiceMethod] [TransactionScope] [SecurityRole(quot;Managerquot;)] public int Add(int n1, int n2) {} } Copyright © Intertech Training 2004 • www.intertechtraining.com • 800-966-9884 • Slide 33
  • 33. ES To Indigo: Notes Most ES code is easily migrated Full support for transaction, security, and lifetime attributes Attributes that configure the COM+ catalog are ignored Indigo provides a new model for QC and LCE – Current related ES attributes are ignored Copyright © Intertech Training 2004 • www.intertechtraining.com • 800-966-9884 • Slide 34
  • 34. System.Messaging to Indigo No plans for migrating from System.Messaging to Indigo. – Remember, you can still use System.Messaging after you install Indigo – And you can interop with Indigo services via System.Messaging Indigo will have its own queuing mechanism – 1st release likely to build on MSMQ – Programming model may be different from System.Messaging Copyright © Intertech Training 2004 • www.intertechtraining.com • 800-966-9884 • Slide 35
  • 35. Summary - Preparing for Indigo Today Write services using ASMX – Minimize or abstract HTTP Context access – Minimize or abstract SOAP Extensions Use Enterprise Services/DCOM if – Performance is critical – You need ES features (distributed Tx, object pooling) – You don't mind the extra deployment hassles of DCOM Use .NET Remoting if – You must implement custom protocols – Performance is critical and you must cross a firewall (cannot open to DCOM) – You need cross-appdomain communication Use MSMQ if rich messaging support is required – Use System.Messaging rather than MSMQ APIs Copyright © Intertech Training 2004 • www.intertechtraining.com • 800-966-9884 • Slide 36
  • 36. Wrap Up! Intertech offers .NET, Java, and XML training Now Offering Instructor Lead Virtual Training! My Books – Distributed .NET Programming in C# – Distributed .NET Programming in VB.NET Now Available! Applied .NET Attributes Questions? Comments? tbarnaby@IntertechTraining.com Copyright © Intertech Training 2004 • www.intertechtraining.com • 800-966-9884 • Slide 37