© 2008 Studio MikMik
SOA Patterns
Arnon Rotem-Gal-Oz
© Todd Bonita 2009
BEFORE WE BEGIN
SOA
Adheres to
Policy
Binds to
End Point
governed by
Exposes
Serves
Service
Consumer
Understands
Contracts
implements
Service
describes
Key
Component
Sends/Receives
Messages
Sends/Receives
Relation
Distributed
Agents
Pipes and
Filters
Layered
System
Client
Server
Stateless
Comm.
SOA
SOA is derived from
other styles
SOA vs. REST
Distributed
Agents
Pipes and
Filters
Layered
System
Client
Server
Stateless
Comm.
SOA
Replicated
Repository
Uniform
Interface
Cacheable
REST
Virtual
Machine
Code On
Demand
SOA also
means
challenges…
…and patterns can help mitigate them
Virtual Endpoint
Service Instance
Workflodize
Edge Component
Gridable Service
Inversion of Communications
Blogjecting Watchdog
Orchestrated Choreography
Transactable Service
Request/Reply
Composite Frontend
Identity Provider
Parallel Pipelines
Service Firewall
Decoupled Invocation
Saga
Client/Server/Service
Aggregated Reporting
Service Monitor
XSIGHTS, MEET AUDIENCE
AUDIENCE, XSIGHTS
Mobile Integration
Services
Advertizing
Management
Applications
Resources
Reporting
Editorial Integration
Advertisers Integration
Mobile Integration
Services
Monitoring
3G Video
Calls
Usage
Datmart
Billing
Acquisition
3rd parties
Ad Management
Applications
Interactions
Reporting
Data mining
& Statistics
Dedicated
Client
MMS
Targeted
Advertizing
branding
Campaign
Mgmt.
Resources
Paper
Links
Interactions
Editorial Integration
Reports
Data
Interfaces
Web
Front-end
Reference
Data
Advertisers Integration
Publishing
tools
integration
Interaction
Designer
Load balancer
Smart
phones
Web
Server
Web
Server
(IIS/Apache
(IIS/Apache
MMS
Gateway
DMZ
3G
Gateway
3G
Gateway
Camera
Phones
Firewall
Load balancer
App
Server
App
Server
App
Server
App
Server
App
Server
App
Server
App
Server
Operational
Firewall
NMS
BI &
Reporting
Links
Registeration
DB
Datamart
DB
Links
usage
References
Sync.
Server
Paper
Editor
Firewall
Backend
Admin
Console
Web
Server
(IIS/Apache
Advertizing
clients
DMZ
ServiceHost
WD
Agent
Edge
Business
Logic
Resource
Allocator
Event
Broker
The Service host sets up the common components
and services for each Component
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();
}
CHALLENGE – SERVICE
AVAILABILITY
What’s in a 9
0.99 reliability
We have a nice little legacy
business component
And we move it to SOA
0.99
0.99
0.99
0.99
0.99
0.99
0.99
0.99
0.99
Failsafe hardware
Status Technologies
FT Server
Or try to detect failure , handle it and
minimize its effect on overall service
© Rosendahl
What’s the effect of a failure - Server
E1 line = 30
concurrent video
calls
Call Flow
Service
Service Instance
Service Business
logic
End point
Distribute
reaction
request
Dispatcher
Edge
Service Instance
What’s the effect of a failure - Channel
E1 line = 30
concurrent video
calls
Call Flow
Call Flow
Call Flow Channel
Call
CallFlow
Flow
Call FlowChannel
Channel
Call Flow Channel
Channel
Channel
Call Flow
CallChannel
Flow
Call Flow
Channel
Call Flow
CallChannel
Flow Channel Channel
Channel Call Flow
Call Flow Channel
Call Flow
Channel Call FlowChannel
Call FlowChannel
Channel
Service Instance with NLB
Real IP : 1.1.1.4
Windows Host
Edge
Windows Kernel
Real IP : 1.1.1.3
Cluster Host
Service
Instance
Real IP : 1.1.1.2
Cluster Host
Service
Instance
Windows Kernel
Windows Kernel
TCP/IP
TCP/IP
NLB Driver
NLB Driver
NIC Driver
NIC Driver
NIC
NIC
TCP/IP
NIC Driver
NIC
Virtual IP : 1.1.1.1
Alternative : Virtual
Endpoint
CHALLENGE - FLEXIBILITY
Request/Reply
EndPoint
1. Request
2.
Synchronous
processing
3. Reply
Service Consumer
Service
Things look Cool & Simple ™
3G
Call
Session
negations
Render
resutls
Image
extraction
Translation
to links
identification
Parallel Pipelines
Key
EndPoint
Reaction
Pattern Component
Relation
Concern/attribute
Queue
pipeline
pipeline
Edge
Request
SOA Component
Request 1
Request 2
EndPoint
EndPoint
Perform
Task
Perform
Task
pipeline
EndPoint
Perform
Task
Service
3G GW
(RV)
IVP (RV)
SIP Listner
3G VAS (Cestel)
RTP Image Extractor
WS
3G Builder (Cestel)
Alg. Engine
WebRenderer
Resource Manager
Dispatcher
WebConnector
Turn out Complicated & Ugly ™
Inversion of Communications
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/
Service view
[ServiceContract]
public interface ImPostOffice : ImContract, IHandleSendCoupon,
IHandleSendSms,IHandleStatus,IHandleAdminStatus,IHandleWapLink,
IHandleSendMms
{
}
[ServiceContract]
public interface IHandleSendMms
{
[OperationContract]
int SendMms(SendMmsEvent eventOccured);
}
[DataContract]
public class SendMmsEvent : ImEvent
{
/// <summary>
/// end user's number. should be in international format: +[country-code]number. Example: +491737692260
/// </summary>
[DataMember]
public string ToNumber { get; set; }
/// <summary>
/// service's number, usually a short-code. Example: 84343
/// </summary>
[DataMember]
public string FromNumber { get; set; }
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 + "]");
}
Sagas tie instances together for
conversations
Call Recovery
Image
Extractor
SIP
Identification
Alternative : Orchestration
Service
Service
reaction
request
Manage
Process
Protocol
Schedule
Coordinator
route
request
monitor
Workflow instance
Workflow Engine
Orchestration platform
Host
Workflows
Offline
designer
Auxiliary tools
Be Wary of Nano-Services
CHALLENGE - MANAGEMENT
Blogjecting Watchdog
Edge
Service
EndPoint
Monitor
Request
Watchdog
Edge
EndPoint
Reports
Monitor
Watchdog
Agent
Heal
Report
Monitor
Log
Monitor
Monitor
Blogjects concept is about
collaborating objects
RESTful resource management
root
1
2
3
Abcde/
Sessions/
Efgh/
/
Resources/
Dispatchers/
Xyz/
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
ServiceHost
WD
Agent
Edge
Business
Logic
Resource
Allocator
Event
Broker
WatchDog
Service A
Service B
WDWatcher
WatchDog
Call Recovery
Image
Extractor
SIP
Identification
Service Monitor
Collect
Fault
Monitoring
Security
monitoring
Metrics
collection
Reporting &
Dashboarding
Edge/Service
Status
Policy
governance
Notify
Control
Monitor
Service Monitor
Status
Act
Commands
In
Edge/Service
Image of the site-manager
Keep the BIT
http://www.flickr.com/photos/37643027@N00/2050024263/sizes/o/
WatchDog
Call
Recovery
Image
Extractor
X
SIP
Identification
WatchDog
3G Call
Liveliness
Monitor
CHALLENGE - REPORTING
Reporting?! BI?
but the data is fragmented
Aggregated Reporting
EndPoint
Request
Request
report
Produce
reports
Report
ODS
Transpose
Out
EndPoint
Convert
Poll Data
Pre-Proces
Subscribed/
Polled data
Send
Join
Clean
Transform
Edge
Save Data
Load
Aggregated Reporting Service
CHALLENGE – MULTI-TENNANCY
(LIES, I TELL YOU, ALL LIES)
Same event different subscribers
Player
(interaction
Renderer)
Call Flow
Play Movie
Event
Bridge to 3rd
Party
Call Flow
Routing
[ServiceContract]
[Participate("3G")]
public interface ImPlayer : ImContract, IHandleCallStarted, IHandleC
IHandlePlayMovie,IHandleCallAborted
{
}
[ServiceContract]
[Participate("3GPartner")]
public interface ImXsightsGateWay : ImContract,
IHandleCallAborted,
IHandlePlayMovie,
IHandleReadyForSearch,
IHandleSearchStarted,
IHandleJoinThirdParty
{
}
Raise a saga initiating event
Initiator A
Initiator B
Participant A
Capacity : 2
Participant B
Capacity : 1
Now what ?!
Reservation Pattern
Service Instance #1
Business
Logic
Control
Edge
Control
Edge Service Instance #2
Event
Broker
Control Business
Event
Edge
Broker
Logic
Resource
Allocator
Event
Business
Resource
Service
Broker Host Logic
Allocator
Service Host
Resource
Service Host
Service Host
Allocator
Service Host
Reservation
Control
Edge
Event
Broker
Business
Logic
Resource
Service Host
Allocator
Service Host
Service Host
Good old
2PC to the
rescue
© Copyright 2026 Paperzz