A dutch client is considering ERT in Cloud. They raised some concern wrt ETA and multithreading.
Below is the google translation of their question:
I also wondered if it is possible to process the data multi-threaded at ERT in Cloud. The examples I see do not seem to work well in combination with ERT in Cloud. A number use multiple users which is not desirable (due to exchange costs). When we start multiple OmmConsumers with the same login, this causes problems with the token refresh. An OmmConsumer with multiple dispatch threads does not seem to work in a multi-threaded way due to locks in the dispatch method (dispatch threads are waiting for each other). For questions in the developers community I am referred to an example which in my opinion amounts to several OmmConsumers with the same login. Should multiple threads / connections with 1 user be possible?
I found the following question raised however not sure it is related?
Appreciate your input.
According to section 2.8.4 in the link above:
"the application should authenticate once to the EDP gateway. It is up to the application to distribute both refresh and access tokens to all threads/devices using the same machine credentials to connect to ERT Cloud.
The application should obtain a new token periodically from the EDP Gateway using the refresh token, as mentioned in Section 2.8.3. Upon response from the EDP Gateway, the updated access token should be shared within the application so that each of the connections made to the ERT Cloud can supply this common access token in the login/login reissue request message."
That means only one thread or one OmmConsumer using a user(machine) credential can request token from EDP gateway. Several OmmConsumers or multiple threads / connections requesting token with the same user do not work.
Moreover, OmmConsumer does not manage authenticate to EDP gateway. This is performed by its underlying API,ETA ValueAdd. If you use several OmmConsumers with the same user, each ETA ValueAdd requests access token and this will cause problem. Based on my experience, I suggested the client to uses a single OmmConsumer with batch request which can specify multiple RICs in a single request. Otherwise, you need to modify EMA, ETA Value add source code to share access token to the other OmmConsumers.
In my opinion:
To share the token with multiple consumers, the application needs to directly get the token from the EDP gateway. Then, you need to configure consumers to connect to a host on ERT in Cloud with an encrypted connection. Each consumer needs to send a login request which contains the token to ERT in Cloud, and reissue the login request with the new token before the previous token is expired.
In short, instead of relying on session management feature in the Elektron SDK to obtain a token, query service discovery, and reissue a login request, developers may need to implement their own functions inside the application to manage token.