public class MessageMD5ChecksumHandler extends AbstractRequestHandler
Modifier and Type | Field and Description |
---|---|
private static byte |
BINARY_LIST_TYPE_FIELD_INDEX |
private static byte |
BINARY_TYPE_FIELD_INDEX |
private static int |
INTEGER_SIZE_IN_BYTES |
private static org.apache.commons.logging.Log |
log |
private static java.lang.String |
MD5_MISMATCH_ERROR_MESSAGE |
private static java.lang.String |
MD5_MISMATCH_ERROR_MESSAGE_WITH_ID |
private static java.lang.String |
MESSAGE_ATTRIBUTES |
private static java.lang.String |
MESSAGE_BODY |
private static byte |
STRING_LIST_TYPE_FIELD_INDEX |
private static byte |
STRING_TYPE_FIELD_INDEX |
Constructor and Description |
---|
MessageMD5ChecksumHandler() |
Modifier and Type | Method and Description |
---|---|
void |
afterResponse(Request<?> request,
java.lang.Object response,
TimingInfo timingInfo)
Runs any additional processing logic on the specified request (after is
has been executed by the client runtime).
|
private static java.lang.String |
calculateMessageAttributesMd5(java.util.Map<java.lang.String,MessageAttributeValue> messageAttributes)
Returns the hex-encoded MD5 hash String of the given message attributes.
|
private static java.lang.String |
calculateMessageBodyMd5(java.lang.String messageBody)
Returns the hex-encoded MD5 hash String of the given message body.
|
private static void |
receiveMessageResultMd5Check(ReceiveMessageResult receiveMessageResult)
Throw an exception if the MD5 checksums included in the ReceiveMessageResult do not match the
client-side calculation on the received messages.
|
private static void |
sendMessageBatchOperationMd5Check(SendMessageBatchRequest sendMessageBatchRequest,
SendMessageBatchResult sendMessageBatchResult)
Throw an exception if the MD5 checksums returned in the SendMessageBatchResult do not match
the client-side calculation based on the original messages in the SendMessageBatchRequest.
|
private static void |
sendMessageOperationMd5Check(SendMessageRequest sendMessageRequest,
SendMessageResult sendMessageResult)
Throw an exception if the MD5 checksums returned in the SendMessageResult do not match the
client-side calculation based on the original message in the SendMessageRequest.
|
private static void |
updateLengthAndBytes(java.security.MessageDigest digest,
java.nio.ByteBuffer binaryValue)
Update the digest using a sequence of bytes that consists of the length (in 4 bytes) of the
input ByteBuffer and all the bytes it contains.
|
private static void |
updateLengthAndBytes(java.security.MessageDigest digest,
java.lang.String str)
Update the digest using a sequence of bytes that consists of the length (in 4 bytes) of the
input String and the actual utf8-encoded byte values.
|
afterError, beforeRequest
private static final int INTEGER_SIZE_IN_BYTES
private static final byte STRING_TYPE_FIELD_INDEX
private static final byte BINARY_TYPE_FIELD_INDEX
private static final byte STRING_LIST_TYPE_FIELD_INDEX
private static final byte BINARY_LIST_TYPE_FIELD_INDEX
private static final java.lang.String MD5_MISMATCH_ERROR_MESSAGE
private static final java.lang.String MD5_MISMATCH_ERROR_MESSAGE_WITH_ID
private static final java.lang.String MESSAGE_BODY
private static final java.lang.String MESSAGE_ATTRIBUTES
private static final org.apache.commons.logging.Log log
public void afterResponse(Request<?> request, java.lang.Object response, TimingInfo timingInfo)
RequestHandler
afterResponse
in interface RequestHandler
afterResponse
in class AbstractRequestHandler
request
- The low level request being processed.response
- The response generated from the specified request.timingInfo
- Timing information on the request's processing.private static void sendMessageOperationMd5Check(SendMessageRequest sendMessageRequest, SendMessageResult sendMessageResult)
private static void receiveMessageResultMd5Check(ReceiveMessageResult receiveMessageResult)
private static void sendMessageBatchOperationMd5Check(SendMessageBatchRequest sendMessageBatchRequest, SendMessageBatchResult sendMessageBatchResult)
private static java.lang.String calculateMessageBodyMd5(java.lang.String messageBody)
private static java.lang.String calculateMessageAttributesMd5(java.util.Map<java.lang.String,MessageAttributeValue> messageAttributes)
private static void updateLengthAndBytes(java.security.MessageDigest digest, java.lang.String str) throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingException
private static void updateLengthAndBytes(java.security.MessageDigest digest, java.nio.ByteBuffer binaryValue)