Search code examples
jmeterpostmanrestjbpm

Get the next process id instance with Jmeter tool


I am using JMeter tool to send some rest API request to jBPM. I use this post request to create process instances in JBPM with JMeter: enter image description here

This one creates two process instances with id 1 and another process instance with id 2.

I use this one to extract the process instance id = 1:

enter image description here

I use this one to get and exctract the task id: enter image description here enter image description here

How can I modify the JMeter tool to extract only the second process id, for example in my case to extract the process instance id=2? I tried to add +1 in the Regular Expression but it didn't work. I tried it with postman also and this configuration I made only works if I extract the second process instance id, because only the second one have data's like this:

{
  "task-summary" : [ {
    "task-id" : 2,
    "task-name" : "Task",
    "task-subject" : "",
    "task-description" : "",
    "task-status" : "Reserved",
    "task-priority" : 0,
    "task-is-skipable" : false,
    "task-actual-owner" : "wbadmin",
    "task-created-by" : null,
    "task-created-on" : {
  "java.util.Date" : 1622815612000
},
    "task-activation-time" : {
  "java.util.Date" : 1622815612000
},
    "task-expiration-time" : null,
    "task-proc-inst-id" : 64,
    "task-proc-def-id" : "performance-samples.paralleltasks",
    "task-container-id" : "performance-samples_1.0.0",
    "task-parent-id" : -1,
    "correlation-key" : "64",
    "process-type" : 1
  } ]
}

Solution

  • We cannot help without seeing full response including what do you want to extract.

    One thing is obvious: JSON is not a regular language therefore using regular expressions for parsing it is not the best idea.

    JMeter provides JSON Extractor and JSON JMESPath Extractor designed for working with JSON so there is much more convenient, robust, reliable and powerful way of getting the data out of JSON responses, filtering it, running various functions, etc.