Class ChunkedBulkSender
java.lang.Object
ai.attackframework.tools.burp.utils.opensearch.ChunkedBulkSender
Sends traffic documents to OpenSearch using a chunked POST to the standard Bulk API.
Drains from a queue and writes NDJSON (action line + doc line per document) directly into
the request body stream. Avoids building a full batch list and full BulkRequest in
memory. Uses only the production Bulk API (POST /<index>/_bulk); not the
experimental Streaming Bulk API. Thread-safe for concurrent calls; each call performs one
bulk request. Used only by the traffic export path.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classResult of one chunked bulk request: success count and total documents sent. -
Method Summary
Modifier and TypeMethodDescriptionstatic ChunkedBulkSender.Resultpush(String baseUrl, String indexName, BlockingQueue<Map<String, Object>> queue, int maxBatch, long maxBytes, long maxWaitMs) Performs one chunked bulk index request: drains from the queue (respecting batch limits), writes NDJSON toPOST <baseUrl>/<indexName>/_bulk, parses the response.
-
Method Details
-
push
public static ChunkedBulkSender.Result push(String baseUrl, String indexName, BlockingQueue<Map<String, Object>> queue, int maxBatch, long maxBytes, long maxWaitMs) Performs one chunked bulk index request: drains from the queue (respecting batch limits), writes NDJSON toPOST <baseUrl>/<indexName>/_bulk, parses the response.Documents are prepared with the shared export-ID path before writing. Batch is limited by
maxBatchdoc count,maxBytesestimated payload size, andmaxWaitMstime. If no document is available within the firstmaxWaitMs, returns a result with zero attempted count (no request is sent).- Parameters:
baseUrl- OpenSearch base URL (e.g.https://opensearch.url:9200)indexName- target index name (e.g.attackframework-tool-burp-traffic)queue- source of documents; each element is aMapto indexmaxBatch- maximum documents per bulk requestmaxBytes- maximum estimated payload bytes per bulk requestmaxWaitMs- maximum time to wait for the first document before sending- Returns:
- result with success and attempted counts; never
null
-