Skip to content

Conversation

@Parsifal22
Copy link

I encountered the issue with a subscriber reconnecting to a topic. In this request, I provided my solution to this problem.

The file contains a test that creates two threads: one for the publisher and one for the subscriber.

They pass a structure TestType to the topic with two fields: one id: i32 and the other Massage: String.

After a publisher and subscriber connect to the same topic, the publisher sends its messages to topic, and the subscriber reads them using a DataReader. After 2 seconds, the subscriber deletes the thread associated with the DataReader, which it started at the very beginning, thereby simulating a disconnection from reading, and after 2 seconds, it starts it again, simulating a reconnection.

While running tests, I didn't encounter any issues related to Timeout error.
I hope you find this material useful.

To check all the outputs for this test, you need to run:
cargo test --test detect_disconnected_subscriber -- --show-output

and you get this result:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant