Unfolding RIC chain via JET Api

Hello, What is the best way to unfold RIC chains for HTML5/js app? From documentation I learned that it's possible to pass chain to JET Quotes object and it works still there are several problems: - It's impossible to pass more than one chain to Quotes object. Obvious method chaining like `JET.Quotes.quoteSubscription.chain(chains[0]).chain(chains[1]).chain(chains[2])` results in only last chain being passed to Quote object. - Actually it won't unfold the chain, it will start to stream the requested fields, that is why you always need to request at least one field. Of course I can request some reference field like X_RIC_NAME, but it's superfluous - Due to the streaming nature of Quote object, it's impossible to understand number of rics in the chain and so one cannot simply stop the quote subscription after all rics are recieved. The only way to cope with it is to utilize something like window.setTimout method to check in no new data was recieved after the request or something like this These problems lead to an ugly solution for such a simple task as to unfold several chains. Something like this (using linq.js): var resultedrics = [], chainsloaded = 0, chainLoadedHandler = function() { console.debug("All chains loaded"); Enumerable.From(resultedrics).ForEach(function(el) { console.debug(el); }); }, unfoldChains = function(chains) { var unfoldChain = function(chain) { var timeout = false, quoteSubscription, stopChainLoading = function() { quoteSubscription.stop(); console.debug(chain + " loaded"); chainsloaded++; if (chainsloaded === chains.length) { chainLoadedHandler(); } }, quoteSubscriptionHandler = function(subscription, ric, updatedValues) { if (resultedrics.indexOf(ric) === -1) { resultedrics.push(ric); if (timeout) { window.clearTimeout(timeout); timeout = false; } timeout = window.setTimeout(stopChainLoading, 1000); } }; quoteSubscription = JET.Quotes.create(), quoteSubscription.chain(chain) .rawFields(['X_RIC_NAME']) .onUpdate(quoteSubscriptionHandler) .start(); }; Enumerable.From(chains).ForEach(unfoldChain); }; This solution works and works quite fast, still I wonder if there's more clean method to do it. It's possible to unfold several chains in one request via ADC though, but I still have hope to use dedicated JET API for this task. Please advise me if you know a better method. Thank you in advance,

Ivan

Answers

  • I don't think the `JET.Quote` is designed for this type of task. For me, I would go with the ADC solution.
  • Unfortunately, for some reason ADC didn't like the chains I wanted to unfold :) So currently I probably have to stick to JET while investigating the problem with ADC
  • JET doesn't allow multiple chain RICs in one subscription. If you have multiple chain RICS you will need to have multiple subscriptions. You can use the DataTable that is in the Novakit for managing the data for multiple rics and and fields
    https://eegitemea.int.thomsonreuters.com/upg_strategic_development/novakit3/wikis/home There is no particular condition which you can use to stop the subscription because these are all real time fields. For example the 'X_RIC_Name' field for a chain may change if a new RIC is added to it. So i guess either time it out or leave it open to manage any changes.