Interface RequestExecutionEngine
ResourcePool (concurrency, throttling, retries). The run is visible and controllable
as a task on the Burp dashboard.
Obtain an instance from Http.createRequestEngine() or
Http.createRequestEngine(RequestEngineOptions), then drive it one of three ways:
- Eager -
queuethe requests up front, thensendAll(). - Reactive - queue one or more seed requests, then
sendAll(ResponseHandler)and let the handlerqueuefollow-ups as responses arrive. - Streaming - supply a
sourcethat generates requests lazily on demand, for very large or open-ended runs.
Each sendAll overload optionally takes a per-request Duration timeout; the
overloads without one apply a sensible default. The send runs in the background and
sendAll returns immediately with a RequestExecution handle - so a long-running
send never blocks the caller. Each queued request may carry a correlation
label echoed back on its RequestResult.
An engine is single-use: exactly one sendAll call starts its one
run. Any further sendAll call (of any overload) throws IllegalStateException;
create a new engine for another run.
-
Method Summary
Modifier and TypeMethodDescriptionvoidqueue(HttpRequest request) Add a request to the engine's queue.voidqueue(HttpRequest request, String label) Add a request to the engine's queue, tagged with a correlation label that is echoed back on the correspondingRequestResult.label().sendAll()Start the run from the eagerlyqueuedrequests, using the default per-request timeout.sendAll(RequestSource source) Start a run that pulls its requests lazily fromsourceinstead of from a pre-queued list, using the default per-request timeout.sendAll(RequestSource source, ResponseHandler handler) AssendAll(RequestSource), additionally invokinghandleronce per request as it completes - serially (seeResponseHandler) - using the default per-request timeout.sendAll(RequestSource source, ResponseHandler handler, Duration timeout) AssendAll(RequestSource, ResponseHandler), with an explicit per-request timeout.sendAll(RequestSource source, Duration timeout) AssendAll(RequestSource), with an explicit per-request timeout.sendAll(ResponseHandler handler) Start the run with the default per-request timeout, invokinghandleronce per request as it completes - serially, in completion order (seeResponseHandler).sendAll(ResponseHandler handler, Duration timeout) AssendAll(ResponseHandler), with an explicit per-request timeout.AssendAll(), with an explicit per-request timeout: a request with no response withintimeoutis recorded asRequestStatus.TIMED_OUT(and retried per theResourcePool).
-
Method Details
-
queue
Add a request to the engine's queue. Equivalent toqueue(request, "").- Parameters:
request- The full HTTP request to send.
-
queue
Add a request to the engine's queue, tagged with a correlation label that is echoed back on the correspondingRequestResult.label(). The label is opaque to the engine; anulllabel is normalised to"".- Parameters:
request- The full HTTP request to send.label- A correlation label;nullis treated as"".
-
sendAll
RequestExecution sendAll()Start the run from the eagerlyqueuedrequests, using the default per-request timeout. Requests are sent in the background and this method returns immediately with a liveRequestExecutionhandle.- Returns:
- A live handle to the running send.
- Throws:
IllegalStateException- if a run has already been started on this engine.
-
sendAll
AssendAll(), with an explicit per-request timeout: a request with no response withintimeoutis recorded asRequestStatus.TIMED_OUT(and retried per theResourcePool).- Parameters:
timeout- The per-request timeout (positive).- Returns:
- A live handle to the running send.
- Throws:
IllegalArgumentException- iftimeoutis null, zero or negative.IllegalStateException- if a run has already been started on this engine.
-
sendAll
Start the run with the default per-request timeout, invokinghandleronce per request as it completes - serially, in completion order (seeResponseHandler). The handler decides whether each result iskept or droppedand may queue more requests via theRequestExecutionit receives. Returns immediately.- Parameters:
handler- Invoked for each completed request (exceptRequestStatus.DROPPEDones).- Returns:
- A live handle to the running send.
- Throws:
IllegalStateException- if a run has already been started on this engine.
-
sendAll
AssendAll(ResponseHandler), with an explicit per-request timeout.- Parameters:
handler- Invoked for each completed request (exceptRequestStatus.DROPPEDones).timeout- The per-request timeout (positive).- Returns:
- A live handle to the running send.
- Throws:
IllegalArgumentException- iftimeoutis null, zero or negative.IllegalStateException- if a run has already been started on this engine.
-
sendAll
Start a run that pulls its requests lazily fromsourceinstead of from a pre-queued list, using the default per-request timeout. The engine asks the source for the next request only when it has capacity to send it, so requests are generated on demand and memory stays bounded regardless of the total count - use this for very large or open-ended runs. Returns immediately.A streaming run cannot be combined with eagerly
queuedrequests - use one or the other.- Parameters:
source- The lazy source of requests to send.- Returns:
- A live handle to the running send.
- Throws:
IllegalStateException- if a run has already been started on this engine, or if requests were alreadyqueuedon this engine.
-
sendAll
AssendAll(RequestSource), with an explicit per-request timeout.- Parameters:
source- The lazy source of requests to send.timeout- The per-request timeout (positive).- Returns:
- A live handle to the running send.
- Throws:
IllegalArgumentException- iftimeoutis null, zero or negative.IllegalStateException- if a run has already been started, or requests were already queued.
-
sendAll
AssendAll(RequestSource), additionally invokinghandleronce per request as it completes - serially (seeResponseHandler) - using the default per-request timeout. The handler decides whether each result iskept or dropped, which can bound the result set on a large run. Returns immediately.- Parameters:
source- The lazy source of requests to send.handler- Invoked for each completed request (exceptRequestStatus.DROPPEDones).- Returns:
- A live handle to the running send.
- Throws:
IllegalStateException- if a run has already been started, or requests were already queued.
-
sendAll
AssendAll(RequestSource, ResponseHandler), with an explicit per-request timeout.- Parameters:
source- The lazy source of requests to send.handler- Invoked for each completed request (exceptRequestStatus.DROPPEDones).timeout- The per-request timeout (positive).- Returns:
- A live handle to the running send.
- Throws:
IllegalArgumentException- iftimeoutis null, zero or negative.IllegalStateException- if a run has already been started, or requests were already queued.
-