How to set range parameter using invokehttp Processor in nifi? - apache-nifi

I am trying to make a call to api but unable to pass Range parameter in invokeHttp process group. When I added Range parameter in property and running the process group the Range parameter is automatically changing like
But I have defined the Range parameter in nifi invoke HTTP Process group property like

Related

JMeter execute parallel using ForEach Controller

I want to execute request per id so I use ForEach Controller
I'm getting results (list of ids) from SQL in JDBC Request and save in variable name id
I send request inside ForEach Controller with input variable id
The issue is that the requests are sent synchronically, how can I execute requests in parallel in that case?
I can think of the following options:
Convert your variables into properties using __setProperty() function and execute them in parallel in another Thread Group using:
the number of threads equal to the number of matches (rows)
__P() function to read the value(s) from JMeter Properties set by the previous Thread Group
Synchronizing Timer if you need to run the requests at the same time
If your "requests" are HTTP GET ones you can also consider using Parallel Sampler
Opened a new Bug 65420 - ForEach Controller add ability to execute in parallel

Jmeter-While controller is not exiting from loop

I have JDBC request which has modified_date which will populate with value depends on payload size. For small payload it will populate the date and time value immediately, for large size it will take from 10 to 30 minutes.
I have added JSSR223 post processor for JDBC request and i am capturing the modified_date and saving in variable "modified". I have added while controller with ${__javaScript(vars.get("Modified"))=="null"} and added same JDBC request with constant timer.
So the while controller keeps looping and it is not stopping or exiting after the value is populated for modified_date. Can you please help.
As per documentation
Variables, functions (and properties) are all case-sensitive.
So Modified and modified are different beasts, you need to mind the case and change the While Controller's condition to ${__javaScript(vars.get("Modified"))=="null"}
Also you don't need any scripting in order to save JDBC Request sampler result into a variable, just define it under "Variable names" section:
and given your query returns a single result you will have it in ${modified_1} JMeter Variable.
More information: Debugging JDBC Sampler Results in JMeter

Global incrementing field that could used in thread groups in Jmeter

I have a Test which is running for 30 Thread groups and each thread needs a unique variable which will increment and used when the Test is running.I have used a counter in this case which will be used in the API request body.
Now every time I am using the Test I have to manually go and changed the Starting Value and the Number format in the Counter which is lot of manual work since I am using 30 thread groups
My question is Can I use a global variable which will have a way to get a unique number to each thread group which will be used by each API request
I am a beginner for Jmeter so any help will be appreciated.
There's unique number per thread using function ${
__threadNum}
thread number function simply returns the number of the thread currently being executed
Just parameterize it using __P() function like:
Once done you will be able to override the above properties values via -J command-line argument like:
jmeter -JstartingValue=100 -JnumberFormat=00000 -n -t test.jmx
To make the changes permanent you can add the next lines to user.properties file:
startingValue=100
numberFormat=00000
the values which you pass via the command-line will take over the values which are in the user.properties file.
You can also provide default values like:
${__P(startingValue,1)}
so in case if the startingValue property is not set the test will use 1 as the default value.

Working of onTrigger - nifi custom processor

I just started learning about the custom processor in nifi. I want to understand the specific case of working of onTrigger. I am doing some operations in onTrigger function using the property values which are defined in the nifi flow Processor interface.
Ex: Property value in the custom processor takes a string separated by ',' and in the onTrigger function I write a code which converts the string into an array of String and removes the additional white spaces.
My question is will this operation run every time a flowfile passes through the custom processor or will it be converted only once.
I tried going through the official development docs but could'nt find info on this
The Java code of a processor is compiled when you run a Maven build to produce the NAR file. The code is not compiled by NiFi itself.
You then deploy a NAR file to a NiFi instance by placing it in the lib directory, and then you use components from that NAR in your flow by adding them to the canvas.
Once a component is on the canvas and it is started, then the onTrigger method is called according to the scheduling strategy.
Whatever code is in onTrigger will run for every execution of the processor, so your code to read the property and split the value will run every time.
If the property supports expression language from flow files, then you need to run this code every time in onTrigger because the resulting value could be different for every flow file.
if the property does not support expression language from flow files, then you can instead use a method with #OnScheduled and process the property value into whatever you need, and store in a member variable of the processor, this way it only happens one time.

Jmeter - running multiple threads using different author token

I have created a thread with three steps to:
Access token request: it generates a token to be used in step three. This token is stored in a property
${__setProperty(accessToken,${accessToken})}
Logon Get request to hit a url
Logon Post request, pass some data to the url and I have set the Authorisation header using the Bearer + accessToken (the one generated in first step.
Running a single thread it works, perfect; but when I increase the number of threads, the 3 steps are not running in sequence, maybe I have some Access token before the first Logon Post and I see the token this one is using is not the token generated in the first step, it is the last one generated.
If I set a rump time longer of the total execution time it works, but then I cannot run several threads on parallel.
How can I configure the script to run the threads using the correspondent token generated in step 1 in each Post? How can I different properties or variables to store the token of every thread and use them?
Thanks.
Your issue is that you are mixing Variables and Properties.
In summary, as per functions reference:
Variables are per Thread
Properties are shared accross Threads
So don't use setProperty, just use ${accessToken}
Use property only when you want to effect all threads. Otherwise you can save variables in other variable as in User_Parameters where you put new variable name the value can be a different variable as ${accessToken}
filling in the Variable name in the 'Name:' column. To add a new value to the series, click the 'Add User' button and fill in the desired value in the newly added column.
Values can be accessed in any test component in the same thread group, using the function syntax: ${variable}.

Resources