Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
A QlikView Technology White Paper
Published: November, 2011
www.qlik.com
Introduction
Event Driven Execution (EDX) allows the running of QlikView batch jobs based on external events. The primary usage of EDX is to have an external scheduler or Extract,Transform, and Load (ETL) tool (for example, Informatica) run QlikView batch jobs as part of a larger batch process. There are also other use cases, forexample, triggering a QlikView batch when a file arrives and user-initiated batches. This document describes the requirements for each of these three use cases.
The example code (attached below as QMSEDX-v1.exe) and executable (attached below as QMSEDX_CommandLine_v1.exe) that is delivered together with this document uses the new EDX API, which means this document and the example code are useful both when using the EDX functionality for the first time and when migrating from previous versionsof the EDX API.
Use Cases
Using an External Scheduler or ETL Tool
Many large organizations have other batch requirements than just QlikView. Such organizations often use a standard tool to run all batch processes, so that the IT training costs are minimized and common operations (for example, logging and re-launching) are handled in one central place. In addition, QlikView batch processing is almost always reliant on new data being available and in many cases this data is created by other batch processes. An external scheduler or ETL tool can be used to prepare the data and then run the QlikView batch to load it.
Most scheduler and ETL tools are designed to run external batch programs via a command line interface. The reasons for this include:
The main alternative to using a command line tool is using some sort of web services. Unfortunately,web calls cannot be used for long-running processes, since a timeout eventually occurs. A common solution to this problem is to start the process with a web request and then follow it up regularly with subsequent requests to find out if the original request has finished successfully or not.
File Arrival Detection
In many IT departments, the inter-system communication is not orchestrated by ETL or even Enterprise Application Integration (EAI) tools. Instead, files are pushed. For example, a non‑QlikView batch job that extracts data from a production database is typically owned by the IT team running the database, which means the team is responsible for creating and configuring the batch job and ensuring that it runs correctly.On the QlikView side, a program that checks if a file has arrived must be running, so that the file can be used in a subsequent QlikView batch.
In this scenario, simply starting the QlikView batch process should be enough. There is no need to follow its execution. The program is typically a Windows service as it runs all the time.
User-initiated Action
TheQlikView Automation API provides a number of functions that run QlikView batch scripts, for example, Document.Reload(). However, it is normally not a good idea to let users run batch jobs, since a QlikView batch job typically replaces the entire data set of an application used by many users.This means a single user can interfere with the work of all the others unless the QlikView batch is carefully configured. Because of this, the batch functionality is disabled in a QlikView Server deployment.
EDX in QlikView 11
In QlikView 11, EDX runs through the QlikView Management Service (QMS) API. This is a major change from QlikView 10, where EDX is realized by calls directly to a QlikView Distribution Service (QDS). The QMS API is a web service API that uses theSimple Object Access Protocol (SOAP). Client applications make HTTP (web) requests to QMS on port 4799. The system is secured by NT LAN Manager (NTLM) as well as special protective measures to avoid certain types of hijacking attacks known as “time limited service key”. This combination of security means the client application must be written in .NET and therefore the provided example code is .NET projects/solutions developed in Microsoft Visual Studio 2010.
The client application uses NTLM to authenticate a Windows account to QMS. QMS then checks which Windows groups the Windows account for the client application is member of to determine the function calls the user is allowed to make. Most of the QMS API requires membership in a local group called “QlikView Management API”, but to run EDX, a separate group, “QlikView EDX”, should be used. Both groups are local Windows groups on the server where QMS runs.
The client application makes calls to instruct QMS to start a task and in return receives an error code indicating success or failure, as well as an execution ID. The execution ID uniquely identifies the execution of the task as opposed to the task itself. The client application then periodically polls QMS to check the progress of the task execution. This poll request returns a data structure that contains, among other things, the execution status, start time, stop time (if already finished), and a list of new execution IDs. These subsequent execution IDs represent the execution of tasks that are triggered because the initial task has finished. The client application can then follow an entire set of inter-related tasks that together make up a full parallelized batch flow.
Lastly, the example code outputs log information and returns an error code to the operating system. The error code can be recovered in a standard way, for example, by using the %ERRORLEVEL% environment variable in a BAT file.
Changes Compared to Previous Versions
From a functionality perspective, the following has changed compared to using EDX in QlikView 10:
Notes on Using the QMS API
Finally,some notes on using the QMS API in QlikView 11:
When my tables are filled by my ETL, it triggers
"C:\Path to QV Power Tools\QMSEDX_CommandLine\QMSEDX.exe" -task="Folder/application.qvw"
where my "application.qvw" is configured to be reloaded "on an external event" in the management console.
And it works.
You can add "-to=0" if you want your command line to return imediatly.
anyone found a way to kick off tasks from Informatica (running on Linux)? EDX tool works great for us in windows environment and we use it to kick off tasks from SSIS, but I am wondering if the same is possible with Informatica
Hello,
I am trying to implement the solution discussed in this post, but I faced some problems.
I am working on QV Server with Publisher.
Here are the steps I've done (please correct if one is wrong):
1. I copied the two folders "QMSEDX_CommandLine_v1" and "QMSEDX_v1" into the server on a shared folder
2. I modified the QMSEDX.exe.config content like:
-endpoint address="http://myservername:4799/QMS/Service"
-endpoint address="http://myservername:4799/ANY/Service"
3. I also modified the app.config content like above
4. I've created a .bat file in the same shared folder with the following content:
"\\myservername\folder\using EDX for qv 11\QMSEDX_CommandLine_v1\QMSEDX_CommandLine\QMSEDX.exe" -task="Reload of test- demo.qvw" -qms="http://myservername:4799/QMS/Service" -password=""
5. The qvw app that was refered in the above task has been configured to reload on an external event (in the qv management console)
6. I've create a qvw app that calls the .bat file through a button-macro script:
sub SendToQVD
set app=ActiveDocument.GetApplication
app.Launch "\\myservername\folder\reload qvw.bat",""
end sub
So...everything works fine if I press the button directly on the server (the mentioned task starts), but if i open the qvw with "open in server" on another machine (with an admin user), the button is doing nothing...no error and the task isn't starting.
Can anyone help me with this?
Thank you in advance!
Silviu
Hi,
I'm a complete newbie in this area. I have just programmed an app over the last two months or so and four days ago I learnt that a Document_CAL doesn't let á user reload the script from the GUI even if they have the client installed. I didn't know that before, our QlikView_partner never told us.
Now I have to consider this, but I guess a discussion would be a better place.
In one post by Arthur Lee I have found a link to an example of what is probably the most common - and also my - usecase for EDX.
This is a great possibility. It is also the only chance we have if we don't want to have to look for a complete new way of doing this (with a different tool like SQL_database) after working on it for long ...
Best regards,
DataNibbler
-
Just wanted to say thanks - works like a charm.
NoTriggerFound
If you're getting this, please make sure you have a Trigger of type "External Event Trigger" attached to the task.
Granted that you have one, and you're still getting this problem, you might need to erase the external trigger (Apply) and re-create it. For some reason QMSAPI is not picking it up.
Still getting the error? Well, try to remove any other trigger you might have attached to task and leave ONLY the "External Event Trigger".
By going over these 3 options I've managed to always make my EDX calls work fine.
Thanks everyone.
Thank you for your reply, is helpful.
Thanks, it is useful
Hi ,
I have requirement to run EDX task from Client machine. For that, i have created EDX job and trying to execute batch command through Macro. It is working file on server (both desktop as well as server access point). But when i am trying to execute from my client machine access point , it throws error "macro parsed failed, functionality was lost." Please help me .
Hi Sagar,
From your post seems like you have two different machines: test (where it's working) and prod (where it doesn't) work.
What's the Qlikview and Windiws version on each?
I'm assuming you have Publisher on both. Am I right?
If you're using macros, you think you can share your script here?
Thanks
D