public class HttpRequestIdProvider extends java.lang.Object implements RequestIdProvider
RequestIdProvider for HTTP protocol. | Modifier and Type | Field and Description |
|---|---|
static io.netty.util.AttributeKey<java.util.concurrent.ConcurrentLinkedQueue<java.lang.String>> |
REQUEST_IDS_KEY |
| Constructor and Description |
|---|
HttpRequestIdProvider(RequestIdGenerator requestIdGenerator,
RequestCorrelator requestCorrelator,
java.lang.String requestIdHeaderName) |
HttpRequestIdProvider(java.lang.String requestIdHeaderName,
RequestCorrelator requestCorrelator) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
beforeClientRequest(io.netty.util.AttributeMap clientAttributeMap)
This does the correlation between an inbound request and all outbound requests that are made during the
processing of the same request.
|
java.lang.String |
beforeServerResponse(ContextKeySupplier responseKeySupplier,
io.netty.util.AttributeMap channelAttributeMap)
This is primarily for response-request correlation for protocols that support multiple requests on the same
connection, eg: using HTTP pipelining.
|
java.lang.String |
getRequestIdContextKeyName()
Name of the context key (to be obtained via
ContextKeySupplier) that is to be used to transfer the
request identifier from one machine to another. |
java.lang.String |
newRequestId(ContextKeySupplier keySupplier,
io.netty.util.AttributeMap channelAttributeMap)
Generates a globally unique request identifier.
|
java.lang.String |
onClientResponse(io.netty.util.AttributeMap clientAttributeMap)
Specifies the request id to be used while receiving a response for a client.
|
java.lang.String |
onServerRequest(ContextKeySupplier keySupplier,
io.netty.util.AttributeMap channelAttributeMap)
Inspects the
keySupplier or context to see if there is a request Id already defined for this
request. |
public static final io.netty.util.AttributeKey<java.util.concurrent.ConcurrentLinkedQueue<java.lang.String>> REQUEST_IDS_KEY
public HttpRequestIdProvider(RequestIdGenerator requestIdGenerator, RequestCorrelator requestCorrelator, java.lang.String requestIdHeaderName)
public HttpRequestIdProvider(java.lang.String requestIdHeaderName,
RequestCorrelator requestCorrelator)
public java.lang.String newRequestId(ContextKeySupplier keySupplier, io.netty.util.AttributeMap channelAttributeMap)
RequestIdGeneratornewRequestId in interface RequestIdGeneratorkeySupplier - ContextKeySupplier for the request.channelAttributeMap - Channel attribute map, normally obtained as ChannelHandlerContext.channel()public java.lang.String onServerRequest(ContextKeySupplier keySupplier, io.netty.util.AttributeMap channelAttributeMap)
RequestIdProviderkeySupplier or context to see if there is a request Id already defined for this
request. If it is, then it returns the same, else returns null
* This method is NOT idempotentonServerRequest in interface RequestIdProviderkeySupplier - The key supplier where usually an externally defined request Id is present.channelAttributeMap - Channel attribute map, normally obtained as ChannelHandlerContext.channel()null if none exists.public java.lang.String beforeServerResponse(ContextKeySupplier responseKeySupplier, io.netty.util.AttributeMap channelAttributeMap)
RequestIdProviderbeforeServerResponse in interface RequestIdProviderresponseKeySupplier - ContextKeySupplier for the response.channelAttributeMap - Channel attribute map, normally obtained as ChannelHandlerContext.channel()null otherwise.public java.lang.String beforeClientRequest(io.netty.util.AttributeMap clientAttributeMap)
RequestIdProviderbeforeClientRequest in interface RequestIdProviderclientAttributeMap - Client's channel attribute map, normally obtained as
ChannelHandlerContext.channel()null otherwise.public java.lang.String onClientResponse(io.netty.util.AttributeMap clientAttributeMap)
RequestIdProvideronClientResponse in interface RequestIdProviderclientAttributeMap - Client's channel attribute map, normally obtained as
ChannelHandlerContext.channel()null otherwise.public java.lang.String getRequestIdContextKeyName()
RequestIdProviderContextKeySupplier) that is to be used to transfer the
request identifier from one machine to another.getRequestIdContextKeyName in interface RequestIdProvider