Class PipelineMessageClassifier
A classifier that can evaluate a PipelineMessage in two ways. First, given an HTTP message, the PipelineMessageClassifier can determine whether the service response it holds should be considered an error response. Second, given an HTTP message and an optional pipeline exception, the classifier can determine whether or not the ClientPipeline should retry the request.
Inheritance
Namespace: System.Dynamic.ExpandoObject
Assembly: System.ClientModel.dll
Syntax
[System.Runtime.CompilerServices.Nullable(0)]
[System.Runtime.CompilerServices.NullableContext(1)]
public abstract class PipelineMessageClassifier
Constructors
PipelineMessageClassifier()
Declaration
protected PipelineMessageClassifier ();
Properties
Default
A default classifier instance. This classifier will classify a
PipelineResponse with a status code of 4xx
or
5xx
as an error, and with a status code of 408
,
429
, 500
, 502
, 503
and 504
as
retriable.
Declaration
public static System.ClientModel.Primitives.PipelineMessageClassifier Default { get; }
Property Value
PipelineMessageClassifier
|
Methods
Create(ReadOnlySpan<UInt16>)
Create an instance of a PipelineMessageClassifier from a collection of success status codes.
Declaration
[System.Runtime.CompilerServices.NullableContext(0)]
public static System.ClientModel.Primitives.PipelineMessageClassifier Create (ReadOnlySpan<ushort> successStatusCodes);
Parameters
System.ReadOnlySpan<System.UInt16>
successStatusCodes
The status codes that the returned classifier instance will classifiy as success codes. |
Returns
PipelineMessageClassifier
A PipelineMessageClassifier instance that
classifies the status codes provided by
|
TryClassify(PipelineMessage, Boolean)
Attempt to evaluate whether the provided PipelineMessage contains a Response that the client should consider an error response.
Declaration
public abstract bool TryClassify (System.ClientModel.Primitives.PipelineMessage message, out bool isError);
Parameters
PipelineMessage
message
The PipelineMessage to classify. |
System.Boolean
isError
|
Returns
System.Boolean
|
Remarks
Not all classifiers derived from PipelineMessageClassifier
will classify a given PipelineMessage. Returning
false
from TryClassify(PipelineMessage, Boolean)
allows a classifier instance to compose with other classifiers by
passing the classification decision to a later instance.
Default will always return true
from
TryClassify(PipelineMessage, Boolean) and may be used as
the last classifier in any composed classifier collection.
TryClassify(PipelineMessage, Exception, Boolean)
Attempt to evaluate whether the provided PipelineMessage contains a Response that indicates the client should retry the Request.
Declaration
public abstract bool TryClassify (System.ClientModel.Primitives.PipelineMessage message, Exception exception, out bool isRetriable);
Parameters
PipelineMessage
message
The PipelineMessage to classify. |
System.Exception
exception
An System.Exception, if any, that will also be used in the retry classification. Callers are intended to provide any exception thrown during the attempt to send the prior request. |
System.Boolean
isRetriable
|
Returns
System.Boolean
|
Remarks
Not all classifiers derived from PipelineMessageClassifier
will classify a given PipelineMessage. Returning
false
from TryClassify(PipelineMessage, Boolean)
allows a classifier instance to compose with other classifiers by
passing the classification decision to a later instance.
Default will always return true
from
TryClassify(PipelineMessage, Boolean) and may be used as
the last classifier in any composed classifier collection.