Method EnsureAsync
- Namespace
- IntentSharp.Specialist
- Assembly
- IntentSharp.Specialist.dll
EnsureAsync(string, CancellationToken)
Makes sure a fitting specialist is in use for the intent's current definition: reuses the one in use, or the request already recorded for this definition, or sends a new request; then waits, judges the offer and, when it fits, puts it in use. Returns where the intent stands. When a specialist is in use for an earlier definition and the intent's KeepPreviousPolicy allows it, the new request is handled in the background instead, and this returns at once with the specialist in use and the change in Pending.
public Task<SpecialistStatus> EnsureAsync(string name, CancellationToken cancellationToken = default)
Parameters
namestringThe intent's name in Catalog.
cancellationTokenCancellationTokenStops this caller's wait. The shared request, wait and judgement go on for the other callers and finish within the configured waits.
Returns
- Task<SpecialistStatus>
Exceptions
- IntentNotFoundException
The catalog has no intent with that name.
- SpecialistWaitTimeoutException
Every wait ended without an offer.
- SpecialistNotFitException
The offer did not fit and nothing requested another.
- SpecialistRequestLimitException
A request was needed but the hourly limit was reached.
- SpecialistOfferException
The service returned an offer the runtime cannot use.
- SpecialistGuardrailException
A request was needed and the guardrail check at the specialist checkpoint refused it.