Skip to content
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

Improve consumer message sequence and idempotence #29

Closed
yang-xiaodong opened this issue Aug 11, 2017 · 4 comments
Closed

Improve consumer message sequence and idempotence #29

yang-xiaodong opened this issue Aug 11, 2017 · 4 comments
Labels

Comments

@yang-xiaodong
Copy link
Member

In subscribe method, CAP needs to add these two features.

@ah-its-andy
Copy link

Can you describe simply the solution you are working with to improve idempotence?

@yang-xiaodong
Copy link
Member Author

yang-xiaodong commented Aug 18, 2017

@standardcore
In version 2.0, I have wapped the message content with Message class, Message object provider a Id property used to be guarantee message sequence, in consumer method we can check the Id whether it has been processed or not.

@yang-xiaodong yang-xiaodong removed this from the 2.0.0 milestone Sep 1, 2017
@yang-xiaodong
Copy link
Member Author

This feature will be given to the user to ensure.

@yang-xiaodong
Copy link
Member Author

yang-xiaodong commented Jan 7, 2019

CAP does not implement idempotent for several reasons: The following are the receiving end

    1. The message was successfully written, but the execution of the Consumer method failed.

There are many reasons why the Consumer method fails. I don't know if the specific scene is blindly retrying or not retrying is an incorrect choice.
For example: If the consumer is the debit service, if the execution of the deduction is successful, but the failure to write the debit log, the CAP will judge the consumer execution failure, and try again. If the client does not guarantee idempotency, the framework will retry it, which will inevitably lead to serious consequences for multiple deductions.

    1. the implementation of the Consumer method succeeded, but received the same message

The scenario here is also possible. If the Consumer has been successfully executed at the beginning, but for some reason, such as the Broker recovery, and received the same message, the CAP will consider this a new after receiving the Broker message. The message will be executed again by the Consumer. Because it is a new message, the CAP cannot be idempotent at this time.

    1. the current data storage mode can not be idempotent

Since the table of the CAP message is deleted after 1 hour for the successfully consumed message, if the historical message cannot be idempotent. Historically, it means that if the broker has maintained or manually processed some messages for some reason.

    1. Industry practices

Many event-driven frameworks require users to ensure idempotent operations, such as ENode, RocketMQ, etc...

From an implementation point of view, CAP can do some less stringent idempotence, but strict idempotent cannot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants