BulkController Class
Handles generic bulk requests by routing each item to the target endpoint’s handler.
public sealed class BulkController : Microsoft.AspNetCore.Mvc.ControllerBaseInheritance System.Object 🡒 Microsoft.AspNetCore.Mvc.ControllerBase 🡒 BulkController
Remarks
Section titled “Remarks”Clients POST a single JSON object to /automation/bulk that names the target endpoint, the HTTP method,
and a list of items. The controller resolves the target once and streams back one result per item.
Actions annotated with BulkHandlerAttribute<THandler,TResult> (or the body-bearing BulkHandlerAttribute<THandler,TBody,TResult>) are dispatched through the registered handler once for the whole bulk - the optimised path. Everything else is invoked directly, item by item in parallel - the fallback path. A failure for one item never aborts the rest.
Constructors
Section titled “Constructors”BulkController(ILogger<BulkController>) Constructor
Section titled “BulkController(ILogger<BulkController>) Constructor”Initialises the controller.
public BulkController(Microsoft.Extensions.Logging.ILogger<HAKOM.Automation.Http.Net.Api.Bulk.BulkController>? logger=null);Parameters
Section titled “Parameters”logger Microsoft.Extensions.Logging.ILogger<BulkController>
An optional logger for per-request and per-item failure diagnostics.
Methods
Section titled “Methods”BulkController.PostBulk(IBulkRequest, CancellationToken) Method
Section titled “BulkController.PostBulk(IBulkRequest, CancellationToken) Method”Submits a bulk of requests against a single target endpoint.
public System.Collections.Generic.IAsyncEnumerable<HAKOM.Automation.Http.Net.Api.Bulk.BulkItemResponse> PostBulk(HAKOM.Automation.Http.Net.Api.Bulk.IBulkRequest request, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));Parameters
Section titled “Parameters”request IBulkRequest
The bulk request body.
cancellationToken System.Threading.CancellationToken
A System.Threading.CancellationToken to cancel the operation; typically sourced from Microsoft.AspNetCore.Http.HttpContext.RequestAborted.
Returns
Section titled “Returns”System.Collections.Generic.IAsyncEnumerable<BulkItemResponse>
A streaming array of per-item result objects.
Remarks
Section titled “Remarks”The request body names the target endpoint (a path relative to the service root, optionally with a
query string), the HTTP method (GET, POST, PUT, or DELETE), and the
items. Each item brings its own parameters and - for POST/PUT - a body.
Angle-bracket placeholders, e.g. /repositories/<repository>/timeSeries/<timeSeries>/data,
are replaced as plain text with the item parameter of the exact same (case-sensitive) name. A placeholder
may just as well cover part of a segment (id:<id>, <region>_<commodity>)
or sit in a query value. Item parameters that resolve no placeholder become additional query parameters
and override equally-named query parameters hard-coded in the endpoint. An item that leaves a placeholder
unresolved gets a per-item 400 naming it, as does a path parameter value of .. (path traversal);
query values are not restricted.
When the route is served by several actions for different api-version ranges, the api-version
parameter of the bulk request’s Accept header selects among them, falling back to the current
version just like a direct call.
Results are returned as they become available - in completion order on the optimised path, in input order
(once everything finished) on the fallback path. Correlate results via the identifier field rather
than by position.
Every item is written with the serialization parameters of the bulk request’s Accept header (e.g.
casing, timeFormat, numberFormat, api-version), just like the same request sent
on its own. Item bodies are always JSON, whatever other media types the header lists.