Interceptor Hooks Methods for a given interceptor are executed in a predictable order, each receiving the information that is known about the message so far as well as a ExecutionAttributes
object for storing data that is specific to a particular execution.
beforeExecution(software.amazon.awssdk.core.interceptor.Context.BeforeExecution, software.amazon.awssdk.core.interceptor.ExecutionAttributes)
- Read the request before it is modified by other interceptors.modifyRequest(software.amazon.awssdk.core.interceptor.Context.ModifyRequest, software.amazon.awssdk.core.interceptor.ExecutionAttributes)
- Modify the request object before it is marshalled into an HTTP request.beforeMarshalling(software.amazon.awssdk.core.interceptor.Context.BeforeMarshalling, software.amazon.awssdk.core.interceptor.ExecutionAttributes)
- Read the request that has potentially been modified by other request interceptors before it is marshalled into an HTTP request.afterMarshalling(software.amazon.awssdk.core.interceptor.Context.AfterMarshalling, software.amazon.awssdk.core.interceptor.ExecutionAttributes)
- Read the HTTP request after it is created and before it can be modified by other interceptors.modifyHttpRequest(software.amazon.awssdk.core.interceptor.Context.ModifyHttpRequest, software.amazon.awssdk.core.interceptor.ExecutionAttributes)
- Modify the HTTP request object before it is transmitted.beforeTransmission(software.amazon.awssdk.core.interceptor.Context.BeforeTransmission, software.amazon.awssdk.core.interceptor.ExecutionAttributes)
- Read the HTTP request that has potentially been modified by other request interceptors before it is sent to the service.afterTransmission(software.amazon.awssdk.core.interceptor.Context.AfterTransmission, software.amazon.awssdk.core.interceptor.ExecutionAttributes)
- Read the HTTP response after it is received and before it can be modified by other interceptors.modifyHttpResponse(software.amazon.awssdk.core.interceptor.Context.ModifyHttpResponse, software.amazon.awssdk.core.interceptor.ExecutionAttributes)
- Modify the HTTP response object before it is unmarshalled.beforeUnmarshalling(software.amazon.awssdk.core.interceptor.Context.BeforeUnmarshalling, software.amazon.awssdk.core.interceptor.ExecutionAttributes)
- Read the HTTP response that has potentially been modified by other request interceptors before it is unmarshalled.afterUnmarshalling(software.amazon.awssdk.core.interceptor.Context.AfterUnmarshalling, software.amazon.awssdk.core.interceptor.ExecutionAttributes)
- Read the response after it is created and before it can be modified by other interceptors.modifyResponse(software.amazon.awssdk.core.interceptor.Context.ModifyResponse, software.amazon.awssdk.core.interceptor.ExecutionAttributes)
- Modify the response object before before it is returned to the client.afterExecution(software.amazon.awssdk.core.interceptor.Context.AfterExecution, software.amazon.awssdk.core.interceptor.ExecutionAttributes)
- Read the response that has potentially been modified by other request interceptors.onExecutionFailure(software.amazon.awssdk.core.interceptor.Context.FailedExecution, software.amazon.awssdk.core.interceptor.ExecutionAttributes)
method is provided that is invoked if an execution fails at any point during the lifecycle of a request, including exceptions being thrown from this or other interceptors.Interceptor Registration Interceptors can be registered in one of many ways.
ClientOverrideConfiguration.Builder.addExecutionInterceptor(ExecutionInterceptor)
method.Interceptor Order The order in which interceptors are executed is sometimes relevant to the accuracy of the interceptor itself. For example, an interceptor that adds a field to a message should be executed before an interceptor that reads and modifies that field. Interceptor's order is determined by their method of registration. The following order is used:
ClientOverrideConfiguration.Builder.addExecutionInterceptor(ExecutionInterceptor)
in the order they were added.beforeTransmission(software.amazon.awssdk.core.interceptor.Context.BeforeTransmission, software.amazon.awssdk.core.interceptor.ExecutionAttributes)
, interceptors are applied in forward-order, according to the order described above. When a response is being processed (after and including afterTransmission(software.amazon.awssdk.core.interceptor.Context.AfterTransmission, software.amazon.awssdk.core.interceptor.ExecutionAttributes)
, interceptors are applied in reverse-order from the order described above. This means that the last interceptors to touch the request are the first interceptors to touch the response.Execution Attributes ExecutionAttributes
are unique to an execution (the process of an SDK processing a SdkRequest
). This mutable collection of attributes is created when a call to a service client is made and can be mutated throughout the course of the client call. These attributes are made available to every interceptor hook and is available for storing data between method calls. The SDK provides some attributes automatically, available via SdkExecutionAttribute
.
ncG1vNJzZmirlKB7ornAs6anmaeoe6S7zGihmq6RZK6xtY6lmK2do6l8tLvFra6aqpVkrq6t2ailaJmnqMClt46cpqudX567tbHRnJyprJ%2BnfIbExJysraGfo5avwMSrmp6opKS%2Fb7TTpqM%3D