Using nJAMS Replay command line tool

Using nJAMS Replay command line tool#

Overview#

nJAMS Replay provides a command line interface in addition to the graphical user interface.

Using nJAMS Replay from the GUI is very useful when you want to modify input data and start a single Replay on an interactive basis. You can select a single entry, modify the input data, start the Replay, and watch the result instantly.

But if you want to Replay many process executions or want to start Replay(s) as part of a batch script, a command line interface is required. The command line interface of nJAMS Replay allows you to search for log entries based on search parameters you know from using the Query in nJAMS GUI. The result of the search can be displayed on the console or can be stored into a text file that serves as the input for a Replay. If required, you can modify the text file before you start the Replay.

A typical procedure of using the command line interface is as follows:

  1. Execute command line tool to search for the entries that should be replayed afterwards. The result set including the input data will be stored in a text file.

  2. Make sure the result set corresponds exactly to your expectation.

  3. If applicable, modify the result of the search by using a text editor.

  4. Finally execute the command line tool again to Replay the entries of the text file

Note

This release of nJAMS Replay command line tool requires Java 11.

Usage#

java -jar njams-replay-plugin-commandline-5.0.0.jar [options]

where options are

-?,--help <query|replay|all>                           displays the help, use "-? query" or "-? replay" or "-? all" for more detailed information
-b,--batchSize <batchSize>                             Specifies replay batch size. Defaults to 100
-c,--config <configFile>                               config file for connection parameters
-d,--dryRun                                            do not send replay requests to nJAMS.
-e,--encrypt <password>                                encrypts the given password
-i,--instance <user pwd url>                           connection parameter to connect to an instance <user> <password> <instanceURL> sample: "-i user1 password1! http://localhost:8080/njams"
-q,--query <[query]>                                   execute query with optional query string; used in combination with other query args
                                                        e.g.,: -q duration:>123
-qc,--queryCount                                       count only; do not get query results
-qd,--queryDisplay                                     show matching entries
-qf,--queryFile <[filename]>                           write all query results into a single JSON file
-qh,--queryHold <durability>                           query (cursor-) durability, e.g., -qh 1m
-qi,--queryId <[filename]>                             dump all matching LogIds into a JSON file
-qm,--queryMultiFiles <[folder]>                       write each query result into a separate JSON file
-qp,--queryProperties <propertyNames>                  comma spearated list of property names (fields) to be returned additionally
-qx,--queryXml <[folder]>                              write start-data for each query result into a separate XML file
-r,--replay                                            instant replay of query result; use together with -q
-rd,--replayDeepTrace                                  set deep-trace on
-rf,--replayFolder <folder [%name-pattern]>            replay all files in a folder, e.g., -rf /home/user/ %*.json
-ri,--replayId <logId|file>                            replay the given LogId or file
-rr,--replayResult <[filename]>                        write replay results into file
-sf,--searchFrom <startTime>                           search start time, e.g., -sf 2016-01-31T23:00:00
-sfs,--searchFollowUp <OPEN|COMPLETE or 1|2>           search follow-up status; comma separated
-sp,--searchPath <DO|BS|BO >pathPrefix>                search path; e.g., -sp DO ">Domain1"
-sst,--searchStatus <SUCCESS|WARNING|ERROR or 1|2|3>   search status; comma separated
-st,--searchTo <endTime>                               search end time, e.g., -st 2016-01-31T23:59:00
-t,--test                                              test replay only
-tz,--timezone <timezone>                              timezone or offset to be used for queries; defaults to local (Europe/Berlin)
                                                        e.g., -tz UTC
-um,--uriMap <regex=replacement>                       modify the path (URI) before replay
-x,--xslt <xsltFile>                                   apply XSL transformation on start data before replay

Examples#

(1) Search for specific process executions:

The following example searches for entries of a particular process of any status within a specific time interval. The results are stored in separate files in a specified folder.

java -jar njams-replay-plugin-commandline-5.0.0.jar
    -i admin admin http://myserver:8080/njams/
    -q -sf 2019-09-02T16:40:00 -st 2019-09-02T16:50:00
    -sp DO ">fs_pres>C1_Services-1>C1_Services-1-C1_Services>OrderServices/C1/Starter_C1_SendOrder.process"
    -sst SUCCESS,WARNING,ERROR
    -qm ids

and outputs the following:

INFO  Replay Plugin for nJAMS Command Line Interface V5.0.0 (23542)
INFO  Resolved arguments: [-i, admin, ***, http://myserver:8080/njams/, -q, -sf, 2019-09-02T16:40:00, -st, 2019-09-02T16:50:00, -sp, DO, >fs_pres>C1_Services-1>C1_Services-1-C1_Services>OrderServices/C1/Starter_C1_SendOrder.process, -sst, SUCCESS,WARNING,ERROR, -qm, ids]
INFO  Successfully connected admin@http://myserver:8080/njams/api
INFO  nJAMS server version 5.0.0 (23166)
INFO  Replay Plugin for nJAMS V5.0.0 (23542) found.
INFO  Total hits: 6
INFO  100% received
INFO  Disconnected from http://myserver:8080/njams/api
INFO  Finished processing.

The specified command finds 6 entries.

Let’s inspect the command in detail:

-i admin admin http://myserver:8080/njams/

authenticates with user admin and password admin against nJAMS instance http://myserver:8080/njams/

-q -sf 2019-09-02T16:40:00 -st 2019-09-02T16:50:00

queries for entries in time period from 2019-09-02T16:40:00 to 2019-09-02T16:50:00

-sp DO “>fs_pres>C1_Services-1>C1_Services-1-C1_Services>OrderServices/C1/Starter_C1_SendOrder.process”

queries for entries of domain object >fs_pres>C1_Services-1>C1_Services-1-C1_Services>OrderServices/C1/Starter_C1_SendOrder.process

-sst SUCCESS,WARNING,ERROR

where status is either Success, Warning, or Error

-qm ids

write results in separate files into folder ids

(2) Replay results:

The following command replays the content of folder ‘ids’:

java -jar njams-replay-plugin-commandline-5.0.0.jar
    -i admin admin http://myserver:8080/njams/
    -rf ids

and outputs the following:

INFO  Replay Plugin for nJAMS Command Line Interface V5.0.0 (23542)
INFO  Resolved arguments: [-i, admin, ***, http://myserver:8080/njams/, -rf, ids]
INFO  Successfully connected admin@http://myserver:8080/njams/api
INFO  nJAMS server version 5.0.0 (23166)
INFO  Replay Plugin for nJAMS V5.0.0 (23542) found.
INFO  Processing JSON file ids\0264946f-75e9-4a35-83cf-61a8064ac149.json
INFO  Processing JSON file ids\182fbd55-1682-4b29-b93c-4d84382c872c.json
INFO  Processing JSON file ids\55e53c75-ab10-4fc3-b7b4-ae595abd84c2.json
INFO  Processing JSON file ids\7aa868aa-25ed-4a22-96b1-4ec12f8ff6ff.json
INFO  Processing JSON file ids\b310d2d3-3972-45e1-b177-ffd772e9973c.json
INFO  Processing JSON file ids\cdbe3d14-938a-4748-b34c-d36786e985fe.json
INFO  6 replay requests successful
INFO  0 replay requests failed
INFO  6 replay requests total
INFO  Disconnected from http://myserver:8080/njams/api
INFO  Finished processing.

The specific command replayed the 6 found entries.

The command in detail:

-i admin admin http://myserver:8080/njams/

authenticates with user admin and password admin against nJAMS instance http://myserver:8080/njams/

-rf ids

replays file(s) from folder ‘ids’

(3) Use an encrypted connection:

The following example uses an encrypted connection to nJAMS Server. The results are returned into a single file of a given folder:

java -Djavax.net.ssl.keyStore=c:\key\keystore.jks -Djavax.net.ssl.trustStore=qwertz
    -jar njams-replay-plugin-commandline-5.0.0.jar
    -i admin admin https://vslph:njams/
    -q -sf 2017-07-17T00:00:00
    -sp BS CreditCheckService
    -sst ERROR
    -qi Log.json
    -qm pay