IBulkResponseFactory Interface
Creates IBulkResponse<T> instances for a bulk handler to yield.
public interface IBulkResponseFactoryRemarks
Section titled “Remarks”Register this factory via UseAutomation() on the dependency injection container
and inject IBulkResponseFactory into your handler’s constructor.
Use Create<T>(string, Result<T>) to produce one IBulkResponse<T> per input item,
passing the item’s Identifier back as the first argument so that callers can
correlate the response to the original request.
Methods
Section titled “Methods”IBulkResponseFactory.Create<T>(string, Result<T>) Method
Section titled “IBulkResponseFactory.Create<T>(string, Result<T>) Method”Creates a new IBulkResponse<T> that pairs the given identifier with a result.
HAKOM.Automation.Http.Net.Api.Bulk.IBulkResponse<T> Create<T>(string? identifier, HAKOM.ErrorHandling.Core.Net.Api.Result<T> result);Type parameters
Section titled “Type parameters”T
The result value type produced by the bulk handler.
Parameters
Section titled “Parameters”identifier System.String
The correlation identifier to echo back; typically the Identifier value
received from the corresponding input item.
result HAKOM.ErrorHandling.Core.Net.Api.Result<T>
The result of processing the item - success or failure.
Returns
Section titled “Returns”HAKOM.Automation.Http.Net.Api.Bulk.IBulkResponse<T>
A new IBulkResponse<T> instance.
IBulkResponseFactory.CreateCountMismatch<T>(string) Method
Section titled “IBulkResponseFactory.CreateCountMismatch<T>(string) Method”Creates a failure IBulkResponse<T> that signals a handler contract violation: the underlying store or inner handler yielded fewer results than the number of input items, leaving this slot unfilled.
HAKOM.Automation.Http.Net.Api.Bulk.IBulkResponse<T> CreateCountMismatch<T>(string? identifier);Type parameters
Section titled “Type parameters”T
The result value type produced by the bulk handler.
Parameters
Section titled “Parameters”identifier System.String
The correlation identifier to echo back for the unfilled slot, or null if the identifier is not known.
Returns
Section titled “Returns”HAKOM.Automation.Http.Net.Api.Bulk.IBulkResponse<T>
A failure IBulkResponse<T> wrapping a
BulkHandlerResultCountMismatchException.
IBulkResponseFactory.CreateInvalidParameter<T>(string, string, string, Exception) Method
Section titled “IBulkResponseFactory.CreateInvalidParameter<T>(string, string, string, Exception) Method”Creates a failure IBulkResponse<T> for an item that the bulk handler rejects itself, because one of its parameters has an invalid value.
HAKOM.Automation.Http.Net.Api.Bulk.IBulkResponse<T> CreateInvalidParameter<T>(string? identifier, string parameterName, string? value, System.Exception? innerException=null);Type parameters
Section titled “Type parameters”T
The result value type produced by the bulk handler.
Parameters
Section titled “Parameters”identifier System.String
The correlation identifier to echo back; typically the Identifier value received from the
corresponding input item.
parameterName System.String
The name of the route or query parameter with the invalid value.
value System.String
The invalid value, or null if the parameter is missing.
innerException System.Exception
The reason why the value is invalid, written to the item’s problem details as root (an
System.AggregateException as roots, one per inner exception), or null when
there is none.
Returns
Section titled “Returns”HAKOM.Automation.Http.Net.Api.Bulk.IBulkResponse<T>
A failure IBulkResponse<T> wrapping a
BulkHandlerInvalidParameterException.
Remarks
Section titled “Remarks”Use it for the checks a handler makes before the item reaches a store, such as an unparsable route value or a query parameter the endpoint does not accept, so the item fails with status 400 instead of a server error. Errors of the store itself are passed on with Create<T>(string, Result<T>) unchanged.