I’d like to directly interact with an Elastic Search Server (ELS).
(No public access to the ELS, protected and accessed via a custom code endpoint)
Client calls backendless custom rest endpoint -> custom code (check cache) queries ELS -> beatify result, cache, responses to the client (good practice? )
Can I somehow keep a connection open to the ELS or do I have to create a simple http client for every call to the custom service, in order to query the ELS via the Elastic Rest Api?
Sounds stupid to me to always create a new http client. Singletons aren’t available/staying alive in custom code, are they?
In terms of performance and reliability it would be great to have an Elastic Transport Client within backendless. (similar to the caching API which wrapped the Redis cache) Such client is aware of an ELS cluster and therefore can directly point the query to the correct node.
Custom server-code has a limited run-time. Allocated threads will be terminated/destructed upon reaching the limit 5sec(free), 20sec(paid). As a result, allocating a persistent socket to any outside resource would not work. One additional reason for this is scalability - there is no guarantee that a subsequent request will end up in the same CodeRunner container, as a result, any server-side “routine” must be autonomous, without any persistent state (which rules out the concept of singletons).