Download
slide1 n.
Skip this Video
Loading SlideShow in 5 Seconds..
SOA PowerPoint Presentation

SOA

117 Views Download Presentation
Download Presentation

SOA

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. SOA Visão Geral das Funcionalidades de Descoberta e Roteamento de Serviços em WCF 4

  2. jorge.goncalves@rumos.pt • (MCT) Microsoft Certified Trainer • (MCPD) ASP.NET Developer 3.5 • (MCTS) Microsoft Office SharePoint Server 2007 – Configuration • Formador Rumos • Sys Admin DGITA • Consultor • Analista Programador • PG GSI • PG Informática • LIC Informática www.rumos.pt

  3. DEMOS Demo : Creating a Calculator Service Demo : Service Routing Demo : Add-hoc Service Discovery Demo : Managed Service Discovery Comunidade Rumos – Webcasts http://comunidade.rumos.pt/webcasts.rumos Source Code: MSDN (WCF) Samples http://msdn.microsoft.com/en-us/library/dd483346.aspx

  4. Why SOA? • Challenges in Building Business Applications • Objectives of Service-Oriented Architecture • What Is a Service? • The Pillars of SOA • Services Communicate Through Edges

  5. Challenges in Building Business Applications We are living in a distributed world ü Business is agile ü Efficient integration and interoperability are essential ü Costs must be reduced ü Systems have to be scalable, secure, and reliable ü

  6. Objectives of Service-Oriented Architecture SOA is an architectural style designed for building distributed systems ü Agility Productivity Reuse Reduce Cost

  7. What Is a Service? A service exposes functionality by accepting data (requests) and sometimes returning data (responses)

  8. The Pillars of SOA The following properties define a service-oriented architecture: ü Services handle data, not objects ü Services are autonomous ü Services have explicit boundaries ü Services expose contract and policy ü

  9. Services Communicate Through Edges Services expose edges to the outside world—edges can be used for communication with the service ü All interaction with a service is done through an edge ü A service can expose multiple edges ü The edge has an address ü SOA edges are WCF endpoints ü

  10. Demo Creating a Calculator Service • The Service • ServiceHost Class • Endpoint ABC (address binding contract) • Metadata behaviour • Endpoint behaviour • The Client • Proxy Pattern

  11. Routing • The Benefits of Routing • Introduction to the WCF Routing Service • Configuring Routing Using Message Filters • Configuring Routing Endpoints and Filters • Using Custom Filter Types and Content-Based Routing • Using Routers for Protocol Bridging • Using Routers to Mask Service Unavailability • Using Routers for Multicast Messaging

  12. The Benefits of Routing The broker design pattern provides agility and reliability to distributed systems, and enables: ü Content-based load balancing ü Automatically use of fallback services ü Protocol bridging ü Masking of versioning issues ü

  13. Introduction to the WCF Routing Service The Routing Service is part of WCF 4, and is implemented in the System.ServiceModel.Routing.RoutingService class ü Hosted like any other service ü Supports all messaging patterns ü Determines the target service by evaluating each incoming message against a set of message filters ü Implements the ISimplexDatagramRouter, ISimplexSessionRouter,  IRequestReplyRouter, and IDuplexSessionRouter contracts ü

  14. Configuring Routing Using Message Filters Message filters are specified in code or in the Routing configuration section ü Message filters are grouped into filter tables ü The routing configuration contains filter types and a collection of mappings between a message filter and a target endpoint ü The RoutingBehavior defines the filter table to use ü

  15. Configuring Routing Endpoints and Filters <routing> <filters>   <filtername="MatchAllFilter"filterType="MatchAll"/> </filters> <filterTables>   <filterTablename="MyFilterTable">   <addfilterName="MatchAllFilter"endpointName="Service"/>   </filterTable>  </filterTables> </routing> <behaviors> <serviceBehaviors>   <behaviorname="UseRouting">   <routingfilterTableName="MyFilterTable" />   </behavior> </serviceBehaviors> </behaviors> <client> <endpointname="Service“ address="..."binding="...“contract="..."/>      </client>

  16. Using Custom Filter Types and Content-Based Routing WCF supports a wide range of filter types ü You can use XPath filters to inspect the content of the incoming messages ü You can define custom filters (rules) that target messages according to their content ü You can create custom filter types for advanced routing scenarios ü

  17. Using Routers for Protocol Bridging The client-to-router and router-to-service bindings do not have to match ü You can bridge incompatible protocols using a Routing Service as the middle-man ü The client-to-router and router-to-service messaging patterns must match ü

  18. Using Routers to Mask Service Unavailability You can configure the router service to route a message to a backup service if the target service fails; this masks service unavailability and improves reliability ü <routing><filters> <filtername="MatchAllFilter"filterType="MatchAll"/> </filters> <filterTables> <filterTablename="MyFilterTable">           <addfilterName="MatchAllFilter" endpointName="CalcService" backupList="AlternateCalc"/> </filterTable> </filterTables> <backupLists> <backupList>   <addendpointName="AlternateCalc"/> </backupList> </backupLists></routing>

  19. Using Routers for Multicast Messaging The Routing Service supports multicast, enabling publish/subscribe and distribution-style messaging ü If the incoming message matches multiple filters, it will be delivered to each of the target endpoints ü Multicast only works for one-way or duplex messaging; it does not work for request-response messaging ü

  20. WCF Discovery • Introduction to WCF Discovery • Ad-Hoc Discovery Architecture • The Process of Ad-Hoc Discovery • Configuring Ad-Hoc Discovery • Issuing Probe and Resolve Messages • Discovery Proxy Architecture • The Process of the Discovery Proxy • Discovering Services Using a Discovery Proxy

  21. Introduction to WCF Discovery Discovery addresses the question: Where is the service? ü The service’s location is dynamic ü Discovery and Service Repository using WS-Discovery ü Discovery enables agility – choose the service to consume at runtime ü

  22. Ad-Hoc Discovery Architecture WCF 4 introduces WS-Discovery support that consists of two message categories: ü Announcements (Hello/Bye messages) ü Discovery (Probe/Resolve messages) ü

  23. The Process of Ad-Hoc Discovery Service is up Hello Where is the service? Probe CLIENT Resolve Bye Service is down Discovery Announcement

  24. Configuring Ad-Hoc Discovery <behaviorname="SendAnnouncements">   <serviceDiscovery>      <!--specify that announcement messages will be sent and where.-->        <announcementEndpoints>          <endpointkind="udpAnnouncementEndpoint"/>        </announcementEndpoints>   </serviceDiscovery>          </behavior> <service name=“...” behaviorConfiguration="SendAnnouncements">   . . . <!-- listen for discovery request messages. -->     <endpointname="udpDiscovery"kind="udpDiscoveryEndpoint“ endpointConfiguration="adhocDiscoveryEndpointConfiguration"/>  </service>  <standardEndpoints>     <udpDiscoveryEndpoint>     <!--Specify the discovery protocol version and maxResponseDelay-->      <standardEndpointname="adhocDiscoveryEndpointConfiguration“discoveryVersion="WSDiscovery11"maxResponseDelay="00:00:00.600" />    </udpDiscoveryEndpoint>  </standardEndpoints>

  25. Issuing Probe and Resolve Messages The DynamicEndpoint class is used by the client to issue probe messages ü Dynamic endpoints can be defined in code and in the XML configuration file ü The FindCriteria class enables granular discovery ü // Discover endpoints when the client is opened. // The contract is used as the FindCriteria. // UdpDiscoveryEndpoint is used to send Probe message. DynamicEndpoint dynamicEndpoint = newDynamicEndpoint(         ContractDescription.GetContract( typeof(ICalculatorService)),newWSHttpBinding());

  26. DemoAdd-hoc Service Discovery • The Service • behaviourConfiguration for serviceDiscovery • announcementEndpoints for announcements • Enpoint with kind=“udpDiscoveryEndpoint” for discovery • CalcendpointBehaviorConfiguration behaviour for scope criteria • The Client • Endpoint with kind=“dynamicEndpoint” and dynamicEndpointConfiguration for find scope criteria

  27. Discovery Proxy Architecture The discovery proxy enables discovery support outside the enterprise: ü Listens for announcements and caches endpoint information internally ü Forwards “Probe” and “Resolve” messages ü Can function as a router ü

  28. The Process of the Discovery Proxy Service is up Hello Where is the service? PROXY CLIENT Probe Resolve Bye Service is down Subnet Discovery Announcement

  29. Discovering Services Using a Discovery Proxy The DiscoveryClient class calls the discovery proxy; it can also be used to issue “Probe” messages inside the subnet ü // The discovery endpoint points to the discovery proxy Uri probeEndpointAddress = new Uri("net.tcp://localhost:8001/Probe"); DiscoveryEndpoint discoveryEP = newDiscoveryEndpoint(new NetTcpBinding(), newEndpointAddress(probeEndpointAddress)); // Call the discovery proxy DiscoveryClient discoveryClient = newDiscoveryClient(discoveryEP); FindResponse findResponse = discoveryClient.Find( newFindCriteria(typeof(ICalculatorService))); if (findResponse.Endpoints.Count > 0)   InvokeCalculatorService(findResponse.Endpoints[0].Address);

  30. Using Routers for Multicast Messaging The Routing Service supports multicast, enabling publish/subscribe and distribution-style messaging ü If the incoming message matches multiple filters, it will be delivered to each of the target endpoints ü Multicast only works for one-way or duplex messaging; it does not work for request-response messaging ü

  31. Demo 2.2Managed Service Discovery • The Discovery Proxy Abstract Class • The Service • Announces it’s presence in the proxy’s anouncement endpoint • The Client • Endpoint with kind=“dynamicEndpoint” • And dynamicEndpointConfiguration for • find scope criteria • set it’s discovery address endpoint to the proxy’s probe address