Journey Manager (JM) The transaction engine for the platform. | System Manager / DevOps | All versions This feature is related to all versions.
Journey Manager allows you to generate PDF receipts by running a service that uses PhantomJS. There are the following important points you should understand when it comes to using this framework:
The form must be deployed with the Dynamic PDF Receipt Support which creates a form-receipt.dat
HTML receipt template. You can see this file if you open a far file in 7Zip as shown below:
Old forms that used LiveCycle Output to create PDFs will have a form-receipt.xdp
. These must be republished with Dynamic PDF Receipt Support, generated to include the form-receipt.dat html receipt template.
The main configuration file for PhantomJS is rasterize.js. The content of rasterize.js changes depending upon the version of Manager
Manager will create a temporary directory based upon the form submission id. The receipt maybe generated by different threads such as a scheduled job or by the end user clicking on the download receipt button. To avoid thread conflict between the user initiated rendering and the scheduled job.
The delivery directory is used when a system is calling a schedule job, for example, \avoka\transact\manager\work\phantomjs\delivery\1234
The web directory is used when a user clicks to download the receipt, for example, \avoka\transact\manager\work\phantomjs\web\1234
The form.html
is theinput created by Manager. The form.pdf
is the rasterized PDF output that is created by PhantomJS.
The directory is cleaned up (Deleted) after the rendering is complete.
Manager 4.3.0 contains a test tab which has the option of not deleting the temporary directory form.htm. This only applies to forms that are rendered from the test tab.
The Java class behind this is PhantomJSRenderReceiptService.java
Below are the default service parameters and the description for Manager.
maxProcesses: Manager will restrict the number of instances of PhantomJS that run at the same time. This is done using a Semaphore in the Java code.
Manager Version Specific
processTimeout
as a service parameter. The renderProcessTimeout
is held in the rasterize.js on each server node.processTimeout
can be overridden in the Form Version Template.Manager calls PhantomJS with the following commands
phantomjs rasterize.js URL filename [paperSize.format] [paperSize.margin] [processTimeout] [pageZoomFactor], for example for Manager version 4.2, phantomjs rasterize.js file:///D:/1/phantomjs/form.html D:\1\phantomjs\form.pdf A4 1cm 60000 1
It's used if:
What the process timeout does is it forces phantom to wait for that duration before it tries to rasterize the form into the pdf.
For example if we set a process timeout of 20s for a form.
The problem with this is that the rendering is waiting around idle for 16 additional seconds to every receipt processed.
If we set a timeout of 0s then phantom may not have rendered the html before it rasterized the html into a pdf. You end up with a receipt PDF that may not have all the fields, it may be greyed out and it may also contain a percentage complete dialog asshown below.
It is recommended to set the processTimeout
just a bit more than the time it takes phantom to render.
This is used with:
To test if a form contains the callback, search for "callPhantom" either in the far files -> form_receipt.dat or in the generated form.html.
When the HTML rendering (Step 4) has finished the form calls back to to Phantom JS rasterize.js to say I am done, you can proceed with the rendering.
A default process timeout of 20s is set with the forms to deal with cases where the form fails to trigger the callback. If a form is taking over 20s to render its usually because of a bug in the form.
Why is Manager allowing my phantom receipt to take longer that the timeout specified? I have specified a timeout of 20s but my receipts take 22s to run.
Transaction Manager creates the phantom receipt in a new thread. It kills the thread if that thread is taking2 x timeoutProcess.
With the above example it gives the instance of phantom40sto complete Steps 1-6.
The following batch file (test.bat) calls phantomJS to render a html file. This can be the form.html produced by Manager. It calls phantomjs to produce the form.pdf file. It backs up the last 5 files so you can compare the files.
echo %time%
@REM phantomjs rasterize.js file:///D:/1/phantomjs/form.html D:\1\phantomjs\form.pdf A4 1cm 60000 1
@REM phantomjs rasterize.js file:///D:/1/phantomjs/form.html D:\1\phantomjs\form.pdf A4 1cm 30000 1
@REM phantomjs rasterize.js file:///D:/1/phantomjs/form.html D:\1\phantomjs\form.pdf A4 1cm 0 1
phantomjs rasterize.js file:///D:/1/phantomjs/form.html D:\1\phantomjs\form.pdf A4 1cm 20000 1
echo %time%
d:
cd \1\phantomjs
dir form.pdf
@copy form_4.pdf form_5.pdf
@copy form_3.pdf form_4.pdf
@copy form_2.pdf form_3.pdf
@copy form_1.pdf form_2.pdf
@copy form.pdf form_1.pdf
del form.pdf
pause
In the Manager Receipt Test Harness there is a button 'Test HTML Receipt'. This will render the HTML that will be sent to phantom to rastorize.
Using the network tab in the debug tools look to check that all resources that the form attempts to load are actually available. You will need to refresh the page to be able to observe this.
If the phantom process has problems accessing resources this can cause a number of odd receipt issue and particularly plays havoc with Web Fonts. Timeouts are also a symptom of this.
Also look for any resources that are loaded from a location other than the Manager server. If these types of resources are used receipt rendering can have problems as the phantom receipt process running in the server environment will need to reach out for these resources and this level of network activity will also be slow and may well be blocked. Including all resources and fonts in the far file is the best approach.
If there are more than 2 (ServiceParameter.maxProcesses) PhantomJS.exe programs running but not finishing in Task Manager (Windows) or Linux equivalent. Manager won't be able to render forms.
Replacing the rasterize.js on Staging whilst the Manager was running caused an issue where the running PhantomJS.exe failed to stop. The result was that 4 processes were left running. Transaction Manager started to render forms correctly after these were killed off.
Only replace rasterise.js when the Manager server has been stopped.
Since PhantomJS is built from the same WebKit that Google Chrome originated from it is possible to use the Chrome web browser to help identify problems. When a page is loaded in Chrome the active tab will display a status icon, a circulating blue ring . This icon shows when the page is making http requests and waiting for responses, and when it is actually loading resources for the displayed page, images, flash or javascript files for example.
This can be useful for diagnosing errors in receipt generation. As a case, an issue was identified when receipts were timing out during the render process. This was caused by javascript running when the receipt is rendered that was failing. When the form.html was loaded into Chrome the page displayed but continued to display the loading icon providing a point of investigation to locate the cause of the issue.
Next, learn how to configure receipts server node.