Andrea Cosentino created CAMEL-24740:
----------------------------------------

             Summary: camel-opa - support batch policy evaluation
                 Key: CAMEL-24740
                 URL: https://issues.apache.org/jira/browse/CAMEL-24740
             Project: Camel
          Issue Type: New Feature
            Reporter: Andrea Cosentino
            Assignee: Andrea Cosentino


h2. Background

{{camel-opa}} evaluates one policy per exchange, each a blocking HTTP 
round-trip to the OPA server. A route that splits a payload and authorizes each 
element pays one round-trip per element.

The OPA Java SDK already exposes a batch API ({{executePolicyBatch}} / the 
batch {{evaluate}} overloads, with a client-side fallback for servers that do 
not implement the batch endpoint), so the capability is available without a new 
dependency.

h2. Proposal

Let a route authorize a collection in one call - for example an option on the 
producer that, when the body is a {{List}}, builds one input document per 
element and evaluates them as a batch, returning the per-element verdicts.

Design questions worth settling first:

* What the result looks like on the Exchange: a list of verdicts parallel to 
the input, or per-element headers on a split?
* How a partial failure is reported - the SDK's batch response distinguishes 
successful evaluations from per-element errors, and the component's fail-closed 
contract has to hold for the failed subset specifically rather than for the 
batch as a whole.

The second point is the reason this is not a mechanical change: "fail closed" 
for a batch must mean the failed elements are denied, not that a whole batch is 
rejected because one element errored, nor that the batch is allowed because 
most of it succeeded.

h2. Scope

{{main}} only. Additive.




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to