Getting an ad-hoc RefreshMsg while stream is open
TLDR - java consumer app, trying to find the best way to get on-demand/adhoc RefreshMsg for couple of K RICS every few minutes.
Hi,
We're developing a java consumer application. one of the requirements is to make sure that for every RIC we're tracking (~10K), our data is no older than X minutes. this means that for every RIC that did not get UpdateMsg within the past X minutes, we'd like to get an on-demand/adhoc RefreshMsg.
what would be the best way (=cleanest and most efficient) to initiate a RefreshMsg on an already-open stream?
app-specific details:
> pom:
<dependency>
<groupId>com.thomsonreuters.ema</groupId>
<artifactId>ema</artifactId>
<version>3.4.0.0</version>
</dependency>
> our registration to OmmConsumer is based on View (we are interested in only ~20 fids):
private ReqMsg getViewReqMsg(String symbol) {
OmmArray fidsArray = EmaFactory.createOmmArray();
supportedFIDs.forEach(fid -> fidsArray.add(EmaFactory.createOmmArrayEntry().intValue(fid)));
ElementList viewElementList = EmaFactory.createElementList();
viewElementList.add(EmaFactory.createElementEntry().uintValue(EmaRdm.ENAME_VIEW_TYPE, 1));
viewElementList.add(EmaFactory.createElementEntry().array(EmaRdm.ENAME_VIEW_DATA, fidsArray));
return EmaFactory.createReqMsg()
.name(symbol)
.serviceName(service)
.payload(viewElementList);
}
> this is how we are registering to each symbol initially:
private void registerAllSymbols(OmmConsumer consumer) {
symbols.forEach(symbol -> {
ReqMsg reqMsg = getViewReqMsg(symbol);
symbolNameToLoginHandle.put(symbol, consumer.registerClient(reqMsg, appClient));
});
}
> now, when acting upon an 'expired' RIC, this is what we've tried:
Option A: reissue
private Consumer<F> getExpiredSymbolStateHandler(OmmConsumer consumer) {
return expiredSymbolState -> {
String symbolName = expiredSymbolState.getSymbolName();
ReqMsg reqMsg = getViewReqMsg(symbolName);
consumer.reissue(reqMsg, symbolNameToLoginHandle.get(symbolName));
};
}
for some reason, this does not seem to have any effect (we're not getting RefreshMsgs, although UpdateMsgs are received so we know the stream for that RIC is still alive).
Option B: (re)register
private Consumer<F> getExpiredSymbolStateHandler(OmmConsumer consumer) {
return expiredSymbolState -> {
String symbolName = expiredSymbolState.getSymbolName();
ReqMsg reqMsg = getViewReqMsg(symbolName);
symbolNameToLoginHandle.put(symbolName, consumer.registerClient(reqMsg, appClient));
};
}
this seems to work fine whenever the ReqMsg is 'simple' (= no View is involved), but this means getting all fids, which is undesired. when doing the same with View (getViewReqMsg(String symbol) above) we start getting double messages, as if the 2nd register operation opened a new stream on top of the existing one (also undesired, of course)
Option C: unregister + (re)register --> BEST WE GOT SO FAR
private Consumer<F> getExpiredSymbolStateHandler(OmmConsumer consumer) {
return expiredSymbolState -> {
String symbolName = expiredSymbolState.getSymbolName();
ReqMsg reqMsg = getViewReqMsg(symbolName);
consumer.unregister(symbolNameToLoginHandle.get(symbolName));
symbolNameToLoginHandle.put(symbolName, consumer.registerClient(reqMsg, appClient));
};
}
this works fine, but it feels like an overkill when doing it on several Ks of RICs every couple of minutes -- especially when there seem to be more natural options available in the API (like Option A).
obviously we're missing something with options A and B, any thoughts?
Thanks
Best Answer
-
Option A should be the optimal one to get the lastest refresh message.
From my testing, for reissuing with the same view, the view data can be ignored. Therefore, the code for reissue could be:
private Consumer<F> getExpiredSymbolStateHandler(OmmConsumer consumer) {
return expiredSymbolState -> {
String symbolName = expiredSymbolState.getSymbolName();
ReqMsg reqMsg = getViewReissueReqMsg(symbolName);
consumer.reissue(EmaFactory.createReqMsg(), symbolNameToLoginHandle.get(symbolName));
};
}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 中文论坛