1 © talend 2014 service locator talend esb training 2014 jan bernhardt [email protected] zsolt...
TRANSCRIPT
2© Talend 2014
Agenda
➜ Introduction to Service Locator• Problem Definition• Concepts
• Loose Coupling• Automatic Failover• Selection Strategies
• Common Pitfalls➜ Hands-on
• Installation & Configuration• Demo Service using Service Locator
4© Talend 2014
Problem: Tight Coupling
➜ Direct invocation from Application A to Service X• Static endpoint address
Application A Service Xinvokes
5© Talend 2014
Application A Service Xinvokes
Problem: Tight Coupling (Service Blackout)
➜ Service X goes offline• Application A stops working as well• Application A needs to be fixed
• Reconfiguration• or even redeployment
6© Talend 2014
Application Ainvokes
Problem: Tight Coupling (Relocation)
➜ Service X was moved to a new location• Application A stops working• Application A needs to be fixed
• Reconfiguration• or even redeployment
Application A Service X
Service X
7© Talend 2014
Solution: Loose Coupling
Application A
Service Locator
SL Client Service X
SL Client
2: perfo
rms lo
okup
3: returns a
ddress
4: invokes
1: registers
8© Talend 2014
Solution: Loose Coupling
Application A Service X
Service Locator
1: registers
SL Client
SL Client
Service X
SL Client
Service Y
SL Client
1: registers1: registers
3: invokes
2: perfo
rms lo
okup
3: returns a
ddress
9© Talend 2014
Solution: Transparent Failover
Application A Service X
Service Locator
SL Client
Service X
SL Client
SL Client
Service Y
SL Client
1: invokes
4: invokes
Heartbeat
Heartbeat
2: perfo
rms lo
okup
3: returns a
ddress
10© Talend 2014
Highlights
➜ Automatic endpoint registration• Easy to use
➜ Dynamic lookup of endpoints• No reconfiguration needed
➜ Automatic failover• Error handling is transparent to application
➜ Status monitoring• Only active endpoints are used
➜ Transparent extension• No Custom Code inside Application required
11© Talend 2014
Problem: Single Point of Failure
Application A Service X
3: performs lookup
2: registers
SL Client
SL Client
Service X
SL Client
Service Y
SL Client
1: registers
2: registers
Service Locator
12© Talend 2014
Solution: Distributed Services
Application A Service X
Service Locator
SL Client
Service X
Service Y
SL Client
Service Locator
Service Locator
Sync
Sync Sync
SL Client
SL Client3: performs lookup
2: registers
1: registers
2: registers
13© Talend 2014
Solution: Distributed Services
Application A Service X
Service Locator
SL Client
SL Client
Service X
SL Client
Service Y
SL Client
Service Locator
Service Locator
Sync
Sync Sync
2: p
erfo
rms l
ooku
p
1: registers1: registers
4: invokes
3: re
turn
s add
ress
Heartbeat
15© Talend 2014
Problem: Bad Selection
➜ Quality of Service• Poor network connectivity• Services running on weak hardware• Overload of one Service chosen by all clients
➜ Services provide different content• Video Surveillance Stream• Package Counter
➜ Producing additional costs• Some providers may charge each service invocation
16© Talend 2014
Solution: Flexible Selection Strategies
➜ Round Robin• Automatic Load Balancer
➜ Metadata Selection• Localize preferred services
17© Talend 2014
Common Pitfalls
➜ Stateful Services• Session State would be lost or needs to be synchronized• Sticky Selection Strategy recommended
➜ Even number of SL instances• Majority required to re-sync lost nodes
➜ Insufficient Configuration• Client needs to know multiple SL instances
19© Talend 2014
Hands-on: Service Locator
Application A
Service Locator
SL Client Service X
SL Client
2: perfo
rms lo
okup
3: returns a
ddress
4: invokes
1: registers
20© Talend 2014
Hands-on: Enable Locator
➜ Prepare services for locator feature• Add locator feature to service consumer & provider• Set Consumer address to locator://
➜ Install locator service• Locator Server• REST Interface
➜ Install service provider• One on each container
➜ Validate Results• Perform SL lookup (REST)
21© Talend 2014
Hands-on: Metadata Selection
➜ Add config admin support• Add Property-Placeholder in Blueprint
• enable automatic bundle reload
• Create config file in ./etc folder➜ Add metadata to service provider
• Make location configurable➜ Add metadata filter on consumer side
• location = Bonn➜ Validate Results
• Perform SL lookup (REST)