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

[AMQ-8354] Add helper methods needed for replica plugin. #953

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

NikitaShupletsov
Copy link

@NikitaShupletsov NikitaShupletsov commented Jan 10, 2023

AMQ-8354

extracted internal changes from #848 to make it easier to review.

Added some new methods that will be used only in replica plugin.
Updated processDispatchNotification and related methods to work correctly(it's not been used since pure master-slave feature was deleted). it will also be used in the plugin

List of changes:

  • made ConnectionContext#setUserName to be able to differentiate replication context(the context we use to interact with the broker) from every other to prevent replication of replicated events. ( shouldn't impact the broker)
  • added queuePurged method to notify about a queue being purged. needed for queue purge replication. (new method, it shouldn't impact the broker anyhow)
  • added getDispatched method to be able to fetch the list of message we are acknowledging, so we can correctly replicate acks(new method, it shouldn't impact the broker anyhow)
  • added getMatchingMessages method to be able to get messages by selector when the consumer is full. needed for message compaction(new method, it shouldn't impact the broker anyhow)
  • changes in processDispatchNotification, getMatchingMessage and processMessageDispatchNotification to be able to replicate acks correctly. basically a bug fix. (it's not been used since pure master-slave feature was deleted. it shouldn't impact the broker anyhow)

@@ -2387,8 +2495,8 @@ private QueueMessageReference getMatchingMessage(MessageDispatchNotification mes
messages.reset();
while (messages.hasNext()) {
MessageReference node = messages.next();
messages.remove();

Choose a reason for hiding this comment

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

Why move this?

Copy link
Author

Choose a reason for hiding this comment

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

The idea of this change is to delete only the message that we are looking for. Because deleting all messages up to the one we need prevents reading them in future. Basically if we delete them here, we will not be able to get them anymore.

Choose a reason for hiding this comment

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

And? That's now unneeded change in behaviour

Copy link
Author

Choose a reason for hiding this comment

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

I am not sure why. this method is used to "deliver" a specific message by id to a specific consumer. we still want to have the access to all other messages. in case we want to "deliver" them too, or in case there is a real consumer

@jbonofre jbonofre self-requested a review March 13, 2023 16:16
@kenliao94 kenliao94 deleted the feature/replica_broker_internal branch May 13, 2024 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants