Slide 1

Slide 1 text

SOA Patterns © 2008 Studio MikMik

Slide 2

Slide 2 text

Arnon Rotem-Gal-Oz

Slide 3

Slide 3 text

Another quiet day at the office… © Todd Bonita 2009

Slide 4

Slide 4 text

BEFORE WE BEGIN

Slide 5

Slide 5 text

SOA Service describes End Point Exposes Messages Sends/Receives Contracts Binds to Service Consumer implements Policy governed by Sends/Receives Adheres to Component Relation Key Understands Serves

Slide 6

Slide 6 text

SOA is derived from other styles Pipes and Filters Client Server Distributed Agents Layered System Stateless Comm. SOA

Slide 7

Slide 7 text

SOA vs. REST Pipes and Filters Client Server Uniform Interface Virtual Machine Distributed Agents Layered System Replicated Repository Code On Demand Stateless Comm. Cacheable REST SOA

Slide 8

Slide 8 text

SOA also means challenges…

Slide 9

Slide 9 text

…and patterns can help mitigate them Service Firewall Identity Provider Edge Component Request/Reply Transactable Service Saga Workflodize Orchestrated Choreography Client/Server/Service Composite Frontend Decoupled Invocation Gridable Service Parallel Pipelines Virtual Endpoint Service Instance Service Monitor Blogjecting Watchdog Inversion of Communications Aggregated Reporting

Slide 10

Slide 10 text

XSIGHTS, MEET AUDIENCE 
 AUDIENCE, XSIGHTS

Slide 11

Slide 11 text

Mobile Integration Applications Advertizing Management Services Resources Rich Client Link management Web based Link Managment Reporting

Slide 12

Slide 12 text

3G Video Calls MMS Dedicated Client Mobile Integration Applications Acquisition Interactions branding Services Ad Management Interactions Reference Data Links Resources Monitoring Targeted Advertizing Campaign Mgmt. Usage Datmart Reporting Billing Data mining & Statistics Reports Link Managment Publishing tools integration Interaction Designer Web Front-end Data Interfaces 3rd parties

Slide 13

Slide 13 text

Load balancer Web Server (IIS/Apache App Server App Server App Server App Server App Server App Server App Server Web Server (IIS/Apache MMS Gateway 3G Gateway 3G Gateway Load balancer Firewall Firewall BI & Reporting DB Links Datamart usage DB References Links Registeration Sync. Server DMZ Operational Backend Advertizing clients Firewall Web Server (IIS/Apache NMS Paper Editor Smart phones DMZ Camera Phones Admin Console

Slide 14

Slide 14 text

Edge Business Logic WD Agent Event Broker Resource Allocator ServiceHost

Slide 15

Slide 15 text

namespace xsights.Infrastructure.ResourceHost.Interfaces { public interface IResourceHost : IDisposable { ICache Cache { get; } Uri ResourceUri { get; } IPAddress LocalIP { get; } IWatchDogProxy WatchDogProxy { get;} IResourceAllocator ResourceAllocator { get; } ImEventBroker EventBroker { get; } void Open(); void Open(TimeSpan timeout); void Close(); void Close(TimeSpan timeout); int FindFreePort(); } } The Service host sets up the common components and services for each Component

Slide 16

Slide 16 text

CHALLENGE – SERVICE AVAILABILITY

Slide 17

Slide 17 text

What’s in a 9

Slide 18

Slide 18 text

0.99 reliability We have a nice little legacy business component

Slide 19

Slide 19 text

0.99 0.99 0.99 0.99 0.99 0.99 0.99 0.99 0.99 And we move it to SOA

Slide 20

Slide 20 text

Failsafe hardware Status Technologies FT Server

Slide 21

Slide 21 text

Or try to detect failure , handle it and minimize its effect on overall service © Rosendahl

Slide 22

Slide 22 text

What’s the effect of a failure - Server E1 line = 30 concurrent video calls Call Flow Service

Slide 23

Slide 23 text

request reaction Edge Service Instance Dispatcher Distribute Request/Reply End point Service Business logic Service Instance

Slide 24

Slide 24 text

What’s the effect of a failure - Channel E1 line = 30 concurrent video calls Call Flow Channel Call Flow Channel Call Flow Channel Call Flow Channel Call Flow Channel Call Flow Channel Call Flow Channel Call Flow Channel Call Flow Channel Call Flow Channel Call Flow Channel Call Flow Channel Call Flow Channel Call Flow Channel Call Flow Channel Call Flow Channel Call Flow Channel

Slide 25

Slide 25 text

Service Instance with NLB Service Instance NLB Driver Cluster Host NIC Driver TCP/IP Windows Kernel NIC NLB Driver Cluster Host NIC Driver TCP/IP Windows Kernel NIC Virtual IP : 1.1.1.1 Real IP : 1.1.1.2 Real IP : 1.1.1.3 Service Instance Edge Windows Host NIC Driver TCP/IP Windows Kernel NIC Real IP : 1.1.1.4

Slide 26

Slide 26 text

Alternative : Virtual Endpoint

Slide 27

Slide 27 text

CHALLENGE - FLEXIBILITY

Slide 28

Slide 28 text

Request/Reply Service EndPoint Synchronous processing 1. Request 2. 3. Reply Service Consumer

Slide 29

Slide 29 text

Things look Cool & Simple ™ Sessio n negati ons Image extract ion identif ication Transl ation to links Rende r resutls 3G Call

Slide 30

Slide 30 text

Relation Key SOA Component Pattern Component Concern/attribute Edge pipeline Perform Task EndPoint Service Request Reaction EndPoint pipeline Perform Task EndPoint pipeline Perform Task EndPoint Queue Request 2 Request 1 Parallel Pipelines

Slide 31

Slide 31 text

IVP (RV) 3G GW (RV) 3G VAS (Cestel) WS Resource Manager SIP Listner RTP Image Extractor Alg. Engine Dispatcher WebConnector 3G Builder (Cestel) WebRenderer Turn out Complicated & Ugly ™

Slide 32

Slide 32 text

Inversion of Communications

Slide 33

Slide 33 text

Consumer view var sendMmsEvent = new SendMmsEvent() { FromNumber = simpleMessageDetails.DialedNumber, Subject = mmsContents.Subject, ToNumber = simpleMessageDetails.Sender, ImageExtension = mmsContents.ImageExtension, ImageAsByteArray = mmsContents.Image, TextAsByteArray = mmsContents.Text }; eventBroker.RaiseEvent(sendMmsEvent); http://www.flickr.com/photos/crimson_wolf/2851737125/sizes/l/

Slide 34

Slide 34 text

Service view public interface ImPostOffice : ImContract, IHandleSendCoupon, IHandleSendSms,IHandleStatus,IHandleAdminStatus,IHandleWapLink, IHandleSendMms { } [ServiceContract] public interface IHandleSendMms { [OperationContract] int SendMms(SendMmsEvent eventOccured); } [ServiceContract] [DataContract] public class SendMmsEvent : ImEvent { /// /// end user's number. should be in international format: +[country-code]number. Example: +491737692260 /// [DataMember] public string ToNumber { get; set; } /// /// service's number, usually a short-code. Example: 84343 /// [DataMember] public string FromNumber { get; set; }

Slide 35

Slide 35 text

Edge translates external structures to internal ones public int SendMms(SendMmsEvent eventOccured) { var eventContext = eventOccured.ToString(); if (log.IsDebugEnabled) log.Debug("inside 'SendMms', event context = [" + eventContext + "]"); var fromNumber = eventOccured.FromNumber; var sender = mmsSenderFactory.Get(fromNumber); if (null == sender) { if (log.IsWarnEnabled) log.Warn("cannot get mms sender derived from '" + (fromNumber ?? "null") + "'"); return 0; } IMmsSubmitResponse response; try { var mmsMessageDetails = new MmsMessageDetails(eventOccured.ToNumber, eventOccured.TextAsByteArray, eventOccured.ImageAsByteArray, eventOccured.ImageExtension, eventOccured.Subject); response = sender.Submit(mmsMessageDetails); } catch (Exception ex) { log.Error("cannot send mms message, context = [" + eventContext + "]", ex); return 0; } if (log.IsInfoEnabled) { var responseMessage = (null == response) ? "null" : response.ToString(); log.Info("sent mms with event context = [" + eventContext + "], response = [" + responseMessage + "]"); }

Slide 36

Slide 36 text

Sagas tie instances together for conversations

Slide 37

Slide 37 text

SIP Image Extractor Identification X Call Recovery

Slide 38

Slide 38 text

Alternative : Orchestration request Workflow Engine Workflow instance Manage Process route request Host Workflows Schedule Orchestration platform Service Service reaction Auxiliary tools Coordinator Protocol Offline designer monitor

Slide 39

Slide 39 text

Be Wary of Nano-Services

Slide 40

Slide 40 text

CHALLENGE - MANAGEMENT

Slide 41

Slide 41 text

Edge Watchdog Edge Report EndPoint Service Request Monitor EndPoint Watchdog Agent Monitor Heal Log Reports Monitor Monitor Monitor Blogjecting Watchdog

Slide 42

Slide 42 text

Blogjects concept is about collaborating objects

Slide 43

Slide 43 text

/ Sessions/ Abcde/ Efgh/ Resources/ Dispatchers/ Xyz/ root 1 2 3 RESTful resource management

Slide 44

Slide 44 text

http://devrig:52141/RM/Sessions/abc/ • ATOMPUB – Session details • URI (ID) • State (start/end/status etc.) • Resources – Knows status – URI for the Resource representation on the RM – URI for the Resource itself

Slide 45

Slide 45 text

Edge Business Logic WD Agent Event Broker Resource Allocator ServiceHost

Slide 46

Slide 46 text

WatchDog Service A Service B WDWatcher

Slide 47

Slide 47 text

SIP Image Extractor Identification X Call Recovery WatchDog

Slide 48

Slide 48 text

No content

Slide 49

Slide 49 text

Status Service Monitor Edge/Service In Commands Metrics collection Policy governance Security monitoring Fault Monitoring Reporting & Dashboarding Control Edge/Service Status Monitor Act Collect Notify Service Monitor

Slide 50

Slide 50 text

Image of the site-manager

Slide 51

Slide 51 text

Keep the BIT http://www.flickr.com/photos/37643027@N00/2050024263/sizes/o/

Slide 52

Slide 52 text

SIP Image Extractor Identific ation X Call Recovery WatchDog WatchDog Liveliness Monitor 3G Call

Slide 53

Slide 53 text

CHALLENGE - REPORTING

Slide 54

Slide 54 text

Reporting?! BI? 
 but the data is fragmented

Slide 55

Slide 55 text

Aggregated Reporting Subscribed/ Polled data Poll Data Edge Aggregated Reporting Service EndPoint ODS Out Pre-Proces Save Data Load report Convert Request Send Clean Join Transform Transpose Produce reports Report EndPoint Request

Slide 56

Slide 56 text

CHALLENGE – MULTI-TENNANCY 
 (LIES, I TELL YOU, ALL LIES)

Slide 57

Slide 57 text

Same event different subscribers Call Flow Player (interaction Renderer) Call Flow Bridge to 3rd Party Play Movie Event

Slide 58

Slide 58 text

Routing [ServiceContract] [Participate("3G")] public interface ImPlayer : ImContract, IHandleCallStarted, IHandleC IHandlePlayMovie,IHandleCallAborted { } [ServiceContract] [Participate("3GPartner")] public interface ImXsightsGateWay : ImContract, IHandleCallAborted, IHandlePlayMovie, IHandleReadyForSearch, IHandleSearchStarted, IHandleJoinThirdParty { }

Slide 59

Slide 59 text

Initiator A Initiator B Participant B Capacity : 1 Raise a saga initiating event Now what ?! Participant A Capacity : 2

Slide 60

Slide 60 text

Reservation Pattern

Slide 61

Slide 61 text

Event Broker Service Host Resource Allocator Business Logic Control Edge Service Host Service Host Business Logic Event Broker Service Host Resource Allocator Control Edge Service Instance #1 Service Host Business Logic Event Broker Service Host Resource Allocator Control Edge Service Instance #2 Service Host Business Logic Event Broker Service Host Resource Allocator Control Edge Reservation

Slide 62

Slide 62 text

Good old 2PC to the rescue