-
Notifications
You must be signed in to change notification settings - Fork 230
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
Fix handling MQTT messages sent while ditto offline #1794
Fix handling MQTT messages sent while ditto offline #1794
Conversation
I have some concerns regarding the PR, but at least it's at a point when the functionality looks working, so I mark it as ready for review. Solution DescriptionThere are 2 kinds of messages that are lost:
The implemented solution extracts consuming messages into dedicated interface - GenericMqttConsumingClient. This interface subscribes to all messages with manual acknowledgement before the connection is established. It is used then as source for per-connection-source messages (including messages from previous session that match corresponding topics, they will be processed) and as source for messages from previous session that the connection is no longer interested in (they will be just acknowledged). My Concerns about Implementation
Sometimes during tests I see following error in console:
The solution is described at page mentioned in error. I already check if the object is disposed before raising error, so solution seems to be adding global error handler which sounds awkward to me. Also previously the code used rxJava, but did not have the handler, so I guess, I might be using it wrong. Suggestions are welcome.
In general I'm not sure if using Subject is OK for rxJava. I've struggled many weeks to create the code that buffers items until it's told to stop, at least, it passes the tests. It might be better to create custom Subject, not sure.
I don't like specifying timings explicitly. Not only they are specific to machine where the tests run, but also they disregard duration scale.
Probably, we could minimize number of tests by removing some test methods. |
ef20db4
to
eaeac18
Compare
Looks like the changes fix #1768 as well |
@dimabarbul awesome, thanks a lot. @kalinkostashki @alstanchev could you run the system tests on this feature branch to check if mqtt tests still pass? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @dimabarbul
Sorry, that it took a little, but not I had the chance to have a look at the PR.
I must say, that is the highest quality contribution to Ditto I ever saw. Thanks a lot for this.
The abstraction for the integration-tests, starting containers (Mongo/Mosquitto) is really great to have and very well done 👍
So I am really glad you fixed the issue(s) and improved testability by doing so.
One class may be "final" (which I commented inline), but the rest: LGTM!
Resolves #1767
Current version of the PR contains only integration tests, so it's draft PR.