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

Add the documentation for ReliableMessageListener [API-2182] #941

Merged
merged 23 commits into from
Jan 8, 2024

Conversation

ihsandemir
Copy link
Contributor

@ihsandemir ihsandemir commented Dec 25, 2023

Added the documentation section to describe the ReliableTopic ReliableMessageListener interface and capabilities.

@ihsandemir ihsandemir added documentation Improvements or additions to documentation enhancement New feature or request labels Dec 25, 2023
@ihsandemir ihsandemir added this to the 5.4 milestone Dec 25, 2023
@ihsandemir ihsandemir self-assigned this Dec 25, 2023
Copy link

netlify bot commented Dec 25, 2023

Deploy Preview for hardcore-allen-f5257d ready!

Name Link
🔨 Latest commit 76aadeb
🔍 Latest deploy log https://app.netlify.com/sites/hardcore-allen-f5257d/deploys/65967cfc888a470008432c72
😎 Deploy Preview https://deploy-preview-941--hardcore-allen-f5257d.netlify.app/hazelcast/5.4-snapshot/events/object-events
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Member

@srknzl srknzl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like we should somehow give a link to the source code after all this nitty gritty details. (due to references of methods) You can even copy the interface and paste it in the documentation

@ihsandemir
Copy link
Contributor Author

I feel like we should somehow give a link to the source code after all this nitty gritty details. (due to references of methods) You can even copy the interface and paste it in the documentation

Added link at commit 0efad8f

@Serdaro
Copy link
Contributor

Serdaro commented Dec 26, 2023

@ihsandemir , two things I'd like to get your opinion:

@ihsandemir
Copy link
Contributor Author

@ihsandemir , two things I'd like to get your opinion:

@Serdaro Yes, definitely we can move the content to that section. Naturally, I was thinking that it needs to be under associated data structure but you probably made a choice to put them separately for some reason. Just for consistency, I can move it to that section.

The new callback onCancel is the answer to "callback on canceling the listeners" topic, well we can put more details if you think the current description is not enough.

…nto the object-events.adoc and added a sample code.
@ihsandemir
Copy link
Contributor Author

@ihsandemir , two things I'd like to get your opinion:

@Serdaro Yes, definitely we can move the content to that section. Naturally, I was thinking that it needs to be under associated data structure but you probably made a choice to put them separately for some reason. Just for consistency, I can move it to that section.

The new callback onCancel is the answer to "callback on canceling the listeners" topic, well we can put more details if you think the current description is not enough.

Changed as requested. Can you review again @Serdaro ?

docs/modules/data-structures/pages/reliable-topic.adoc Outdated Show resolved Hide resolved

link:https://github.com/hazelcast/hazelcast/blob/master/hazelcast/src/main/java/com/hazelcast/topic/ReliableMessageListener.java[ReliableMessageListener] is a link:https://github.com/hazelcast/hazelcast/blob/master/hazelcast/src/main/java/com/hazelcast/topic/MessageListener.java[MessageListener] to better integrate with the reliable topic.

If a regular MessageListener is registered on a reliable topic, the message listener works fine, but it can't do much more than listen to messages.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
If a regular MessageListener is registered on a reliable topic, the message listener works fine, but it can't do much more than listen to messages.
If a `MessageListener` is registered on a reliable topic, it can listen to messages.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to :

If a regular MessageListener is registered on a reliable topic, it can't do much more than listening to new messages but the ReliableMessageListener gives you more capabilities on controlling the listener behaviour.

If a ReliableMessageListener is registered on a normal ITopic, only the methods inherited from MessageListener are called.

docs/modules/events/pages/object-events.adoc Outdated Show resolved Hide resolved

**Durable Subscription**

The ReliableMessageListener allows you to control where you want to start processing a message when the listener is registered. This makes it possible to create a durable subscription by storing the sequence of the last message and using this sequenceId as the sequenceId to start from.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The ReliableMessageListener allows you to control where you want to start processing a message when the listener is registered. This makes it possible to create a durable subscription by storing the sequence of the last message and using this sequenceId as the sequenceId to start from.
You can use the `ReliableMessageListener` to control where you want to start processing a message when the listener is registered. This supports the creation of a durable subscription by storing the sequence of the last message and then starting from this `sequenceId`.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to:

You can use the ReliableMessageListener to control which message you want processing to start when the listener is registered. This supports the creation of a durable subscription by storing the sequence of the last message and then re-starting from this sequenceId.


**Exception Handling**

The ReliableMessageListener also gives the ability to deal with exceptions using the `isTerminal(Throwable)` method. This method allows you to control which exceptions should terminate the execution of the listener and cancel it. If a plain MessageListener is used, it won't terminate on exceptions and it will keep on running. But in some cases it is better to stop running.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The ReliableMessageListener also gives the ability to deal with exceptions using the `isTerminal(Throwable)` method. This method allows you to control which exceptions should terminate the execution of the listener and cancel it. If a plain MessageListener is used, it won't terminate on exceptions and it will keep on running. But in some cases it is better to stop running.
The `ReliableMessageListener` also copes with exceptions using the `isTerminal(Throwable)` method. This method allows you to control which exceptions can terminate and cancel the listener. If a `MessageListener` is used, it doesn't terminate following an exception and continues to run. In some situations, such as ????, it is better to cancel the listener following an exception.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you'll need to replace the ???? with a quick example of when this is the preferred behaviour

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed as:

The ReliableMessageListener also copes with exceptions using the isTerminal(Throwable) method. This method allows you to control which exceptions can terminate and cancel the listener. If a MessageListener is used, it doesn't terminate following an exception and continues to run. In some situations, such as cluster being stopped, it is better to cancel the listener following the exception.

docs/modules/events/pages/object-events.adoc Outdated Show resolved Hide resolved
docs/modules/events/pages/object-events.adoc Outdated Show resolved Hide resolved
docs/modules/events/pages/object-events.adoc Outdated Show resolved Hide resolved
docs/modules/events/pages/object-events.adoc Outdated Show resolved Hide resolved
docs/modules/events/pages/object-events.adoc Outdated Show resolved Hide resolved
docs/modules/events/pages/object-events.adoc Outdated Show resolved Hide resolved
docs/modules/events/pages/object-events.adoc Outdated Show resolved Hide resolved
docs/modules/events/pages/object-events.adoc Outdated Show resolved Hide resolved
docs/modules/events/pages/object-events.adoc Outdated Show resolved Hide resolved
docs/modules/events/pages/object-events.adoc Outdated Show resolved Hide resolved
docs/modules/events/pages/object-events.adoc Outdated Show resolved Hide resolved
docs/modules/events/pages/object-events.adoc Outdated Show resolved Hide resolved
Copy link
Contributor

@rebekah-lawrence rebekah-lawrence left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One last suggestion - for consistency in the wording of the sections on this page - this section could be headed:

Listening for Reliable Messages

@ihsandemir ihsandemir requested review from srknzl and removed request for srknzl January 4, 2024 10:02
@ihsandemir ihsandemir merged commit ca0c2d2 into hazelcast:main Jan 8, 2024
6 checks passed
@ihsandemir ihsandemir deleted the relaibleListenerDoc branch January 8, 2024 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants