Download presentation
Presentation is loading. Please wait.
Published byMargaret Craig Modified over 9 years ago
1
SOA Visão Geral das Funcionalidades de Descoberta e Roteamento de Serviços em WCF 4
2
www.rumos.pt 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
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 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 ReuseReduce Cost Productivity
7
What Is a Service? A service exposes functionality by accepting data (requests) and sometimes returning data (responses)
8
The Pillars of SOA Services handle data, not objects Services are autonomous Services have explicit boundaries Services expose contract and policy The following properties define a service- oriented architecture:
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, IRequestReplyRoute r, 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
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 <add filterName="MatchAllFilter" endpointName="CalcService" backupList="AlternateCalc"/>
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
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 Introduction to WCF Discovery
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 Hello Bye Probe Resolve Service is up Service is down Where is the service? Discovery Announcement CLIENT
24
Configuring Ad-Hoc Discovery...
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 = new DynamicEndpoint( ContractDescription.GetContract( typeof(ICalculatorService)), new WSHttpBinding());
26
Notes Page Over-flow Slide. Do Not Print Slide. See Notes pane.
27
Demo Add-hoc Service Discovery -The Service -behaviourConfiguration for serviceDiscovery -announcementEndpoints for announcements -Enpoint with kind=“udpDiscoveryEndpoint” for discovery -Calc endpointBehaviorConfiguration behaviour for scope criteria -The Client -Endpoint with kind=“dynamicEndpoint” and dynamicEndpointConfiguration for find scope criteria
28
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
29
The Process of the Discovery Proxy Hello Bye Probe Resolve Service is up Service is down Where is the service? Discovery Announcement PROXY Subnet CLIENT
30
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 = new DiscoveryEndpoint( new NetTcpBinding(), new EndpointAddress(probeEndpointAddress)); // Call the discovery proxy DiscoveryClient discoveryClient = new DiscoveryClient(discoveryEP); FindResponse findResponse = discoveryClient.Find( new FindCriteria(typeof(ICalculatorService))); if (findResponse.Endpoints.Count > 0) InvokeCalculatorService(findResponse.Endpoints[0]. Address);
31
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
32
Demo 2.2 Managed 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
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.