Qlik Fix: How to Use Analytic Connections to Enable Server-Side-Extension (SSE) in Qlik Sense
This video is part of the Qlik Fix Video series. If you found this video useful, check out the other Qlik Fix Videos.
This video will show an example of how Analytic Connections can be used to enable external calculation engines that act as Server Side Extensions (SSE). In this example Qlik Sense connects to an R server for extending expression capabilities in Qlik Sense Apps while offloading the calculations to the R server engine.
Here is a link to more information in the Support Knowledge Base:
Hi and Welcome to Qlik Fix! This video will show an example of how Analytic Connections can be used to enable external calculation engines that act as Server Side Extensions (SSE). In this example Qlik Sense connects to an R server for extending expression capabilities in Qlik Sense Apps while offloading the calculations to the R server engine. Analytics Connection use gRPC protocol to communicate with the Server-Side Extension. gRPC does not support R-Script language, so we need to use the open-source Qlik Sense R-Plugin as a connector to the R-Server. The plugin can be downloaded in this location. Make sure to review the contents of the readme file including the License information. Qlik Support does not support this R plugin software directly, which is provided as-is. Inquiries should be submitted via Github under this location. (https://github.com/qlik-oss/sse-r-plugin/issues) In this example we will download, build, and run the plugin on the R server. First, download and unzip the contents where the plugin will live moving forward. Then, we need to be built it using Microsoft Visual Studios. A pre-requisite for the R-Plugin is Visual Studios 2015 or later. Open the solution file ServerSideExtension.sln and run the build twice. This should create the plugin executable under this location. (sse-r-plugin-master\csharp\SSEtoRserve\bin\Debug) Next, since the plugin default setting is to accept only local requests via the loopback interface, we will configure it to listen for connection requests on all network interfaces of the R server. Open the config file shown here, and under grpcHost, set the value to 0.0.0.0. Also note that in this scenario the default setting of the rserveHost value as the loopback IP, will work since the plugin is being installed on the R server. The R-Plugin connection to R is made to a service called RServe, which may not have been installed yet. RServe can be installed via the R Console in either RGui or RStudio with the following commands: To install the RServe package, will need to pick a mirror. Then invokes the needed library, and then starts the RServe server. Note that additional dependent libraries may need to be installed depending on the desired functionality. See information on this under the GetStarted.md file in GitHub. Next we can run the R-plugin executable SSEtoRserve.exe which will start listening on port 50051 by default. Now we can finally configure the Analytic connection via QMC. The name for the connection is actually used within the Qlik Sense app when invoking the server side extension. We will name it R as it is referenced this way in example Qlik Sense Apps available. The Host field should be set to the hostname of the server running the R-Plugin. Keep in mind that even if the Plugin is installed on the Qlik Sense Central node, if there are other Rim nodes in the environment with the Engine service enabled, the hostname should be set to the actual server name, not as localhost. Next, set the default tcp port for the plugin, and click Apply. The R-plugin includes sample Qlik Sense apps which can be imported. With this particular sample app we can look at basic load script statements and expression that do not require any additional libraries packages. Note in the Load Script editor how the Extension clause needs to precede the name given to the plugin in the configured Analytic Connection, which in this case is named "R". See more information on Load script syntax on Qlik's help site under the following location. (https://help.qlik.com/en-US/sense/November2020/Subsystems/Hub/Content/Sense_Hub/Scripting/ScriptRegu...) In App objects, the expression syntax is similar, and starts with the plugin name configured in the Analytic connection, followed by available functions retrieved from the plugin. When using the default functions included with the R plugin, an R-script string needs to be included as a parameter, along with references to the data to be submitted with the request. In this example, we use the R-Scrip function paste() to concatenate the first and second words submitted as data. In this other KPI object, we use a defined function to only submit the data and obtained the result. Defined functions can be added on the fly to the Function Definitions JSON file shown here. In order to enable this functionality, add the json file path string as the value for the parameter shown here in the plugin configuration file mentioned earlier in the video. The server side extension plugin activity can be observed when running the process interactively. The activity also gets registered in the Log files under this location. Reviewing this sample app we can see more examples of other custom expressions that use the server-side-extension and have the calculation offloaded to the R server. If you’d like more information, Take advantage of the expertise of peers, product experts, and technical support engineers by asking a question in a Qlik Product Forum on Qlik Community. Or search for answers using the new SearchUnify tool. It searches across our Knowledge Base, Qlik Help, Qlik Community, Qlik YouTube channels and more, all from one place. Also check out the Support Programs space. Here you can learn directly from Qlik experts via a Support webinar, like Techspert Thursdays. And don’t forget to subscribe to the Support Updates Blog. Thanks for watching. Nailed it!
Attached is a downloadable .mp4 video file for those who cannot view YouTube videos.