EMA endpoint discovery best practices
I have some questions about the discovery process for EMA connections. What we are currently using is just lifted from some sample code from about 2 years ago and looks like
class EndpointDiscoveryClient implements ServiceEndpointDiscoveryClient {
public void onSuccess(ServiceEndpointDiscoveryResp resp, ServiceEndpointDiscoveryEvent event) {
List<ServiceEndpointDiscoveryInfo> serviceEndpointDiscoveryInfos = resp.serviceEndpointInfoList();
for (ServiceEndpointDiscoveryInfo info : serviceEndpointDiscoveryInfos) {
List<String> locationList = info.locationList();
if (locationList.size() == 2 && locationList.get(0).startsWith(location)) {
host = info.endpoint();
port = info.port();
break;
}
}
}
}
Why test for size == 2
instead of size >= 2
? Will there ever be more than 2 (or just 1)?
Why only use the first one? Are there cases we would fail over to a different host, and if so how do we detect those cases?
We're currently using com.refinitiv.ema:ema:3.7.1.0
Best Answer
-
Thank you for reaching out to us.
Please refer to the Service Discovery example on GitHub.
for(ServiceEndpointDiscoveryInfo info : serviceEndpointResp.serviceEndpointInfoList())
{
if(info.locationList().size() >= 2 && info.locationList().get(0).startsWith(Consumer.location)) // Get an endpoint that provides auto failover for the specified location.
{
endPoint = info.endpoint();
port = info.port();
break;
}
// Try to get backups and keep looking for main case. Keep only the first item met.
else if(info.locationList().size() > 0 && info.locationList().get(0).startsWith(Consumer.location) &&
endPoint == null && port == null)
{
endPoint = info.endpoint();
port = info.port();
}
}This is just an example that shows how to use the ServiceEndpointDiscovery. You can change the way to select the endpoint according to your requirements.
The service endpoint discovery response looks like this:
"services": [
{
"port": 14002,
"location": [
"ap-northeast-1a"
],
"transport": "tcp",
"provider": "aws",
"endpoint": "ap-northeast-1-aws-1-med.optimized-pricing-api.refinitiv.net",
"dataFormat": [
"rwf"
]
},
{
"port": 14002,
"location": [
"ap-northeast-1a",
"ap-northeast-1b"
],
"transport": "tcp",
"provider": "aws",
"endpoint": "ap-northeast-1-aws-3-med.optimized-pricing-api.refinitiv.net",
"dataFormat": [
"rwf"
]
},
{
"port": 14002,
"location": [
"ap-northeast-1b"
],
"transport": "tcp",
"provider": "aws",
"endpoint": "ap-northeast-1-aws-2-med.optimized-pricing-api.refinitiv.net",
"dataFormat": [
"rwf"
]
},You can select the endpoint that closes to your location and has two more more locations for fault tolerance.
Moreover, you can use the ChannelSet configuration in the Consumer.
For example, the first channel in the ChannelSet connects to the endpoint in the ap-northeast location and the second channel in the ChannelSet connects to the endpoint in the ap-southeast location.
1
Answers
-
Hello @daniel.lipofsky
Additionally, you can find more details about the Service Discovery response message from chapter 4 "Connectivity to Refinitiv Real-Time — Optimized" of the Refinitiv Real-Time - Optimized Install and Config Guide document.
1 -
Thank you, that code looks more robust.
ChannelSet
also looks like a good thing - do you have code examples that use it?0
Categories
- All Categories
- 6 AHS
- 39 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 370 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 60 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛