I am using JSR223 Pre processor to generate UUID in http header. The value will be updated in a log file with timestamp for tracking purpose.
I have added the pre processor in each call, so every time it generates an unique value and updates the log file. Please have a look on below code.
import org.apache.jmeter.services.FileServer;
import java.sql.Timestamp;
import java.util.UUID;
String uuid = UUID.randomUUID().toString();
vars.put("p_x_transaction_id",uuid);
uid= vars.get("p_x_transaction_id");
String Logfile=vars.get("p_logfile");
f = new FileOutputStream(Logfile,true);
p = new PrintStream(f);
this.interpreter.setOut(p);
Timestamp timestamp = new Timestamp(System.currentTimeMillis());
p.println(timestamp + " - " + uid);
Is it possible put above code in JSR223 sampler and call the method in header directly?
I have tried but it generates unique value for each iteration only.
Please throw some lights on this.
