HTTP Polling
Learn how to start and stop the polling
HTTP polling is an extension to the HTTP DSL, whose entry point is the poll
method.
Common operations
If you want to deal with several pollers with per virtual users, you have to give them a name and pass this name on each polling operation:
pollerName(name:String)
For example:
poll().pollerName("myCustomName");
poll().pollerName("myCustomName");
poll().pollerName("myCustomName")
poll.pollerName("myCustomName")
Of course, this step is not required if you deal with one single poller per virtual user.
Start polling
The first thing to do is start the polling, by specifying the request and how often it will run:
every(period).exec(request)
The period
parameter is from response received to next request sent.
For example:
exec(
poll()
.every(10)
.exec(http("name").get("url"))
);
exec(
poll()
.every(10)
.exec(http("name").get("url"))
);
exec(
poll()
.every(10)
.exec(http("name").get("url"))
)
exec(
poll
.every(10)
.exec(http("name").get("url"))
)
Stop polling
When you don’t need to poll a request anymore, you can stop the poller:
poll.stop
For example:
exec(
poll().stop()
);
exec(
poll().stop()
);
exec(
poll().stop()
)
exec(
poll.stop
)