-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhance http-kafka idempotency key #28
Comments
On the response side of the message, do we take care of that in zilla or it should be done by producer of the message? |
@akrambek yes, Given that Inside the |
@akrambek btw, using this approach, i think we might be able to safely ignore requests with duplicate More precisely, we would potentially be able to ignore requests with |
When
idempotency-key
http
header is specified by the client, the intention is to detect and prevent duplication of work for repeated requests.Therefore, we check the
reply-to
topic for existing responses, correlated by the value ofidempotency-key
inzilla:correlation-id
header.However, it is possible that the same
idempotency-key
could be used with a differenthttp
request, making the correlated response inappropriate for that distinct request.Additionally, we need to capture the
md5
hash of the request payload and include it in both the request message sent to the requesttopic
and in the filter on thereply-to
topic for the correlated response.This
md5
hash can be appended to the httpidempotency-key
request header value and sent in thezilla:correlation-id
header, so the requirements on the kafka service remain unchanged, i.e. copy the opaque value ofzilla:correlation-id
header on the kafka request message to a correspondingzilla:correlation-id
header on the kafka response message.Then if the same request is repeated, the correlated response will be sent back to the client immediately and the kafka service can safely detect and ignore the duplicate request due to the already processed response.
However, if a different request is sent using the same
idempotency-key
http header, themd5
hash will differ and thezilla:correlation-id
will therefore also differ, causing the new request to be processed by the kafka service as desired.The text was updated successfully, but these errors were encountered: