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

[ISSUE #4556] Implement retry strategy based on pulsar message middleware #4769

Conversation

HarshSawarkar
Copy link
Contributor

Fixes #4556

Motivation

Earlier the retry strategy based on pulsar middleware were only supported

Modifications

Implemented retry strategy based on the Pulsar message middleware.

Documentation

  • Does this pull request introduce a new feature? (yes / no)
  • If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)
  • If a feature is not applicable for documentation, explain why?
  • If a feature is not documented yet in this PR, please create a followup issue for adding the documentation

Copy link

codecov bot commented Feb 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (e837f34) 17.59% compared to head (9db6598) 16.37%.
Report is 14 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #4769      +/-   ##
============================================
- Coverage     17.59%   16.37%   -1.23%     
+ Complexity     1774     1734      -40     
============================================
  Files           797      856      +59     
  Lines         29786    31265    +1479     
  Branches       2573     2700     +127     
============================================
- Hits           5242     5120     -122     
- Misses        24063    25665    +1602     
+ Partials        481      480       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@xwm1992 xwm1992 changed the title Implemented retry strategy based on pulsar message middleware [ISSUE #4556]Implemented retry strategy based on pulsar message middleware Feb 19, 2024
@pandaapo
Copy link
Member

pandaapo commented Feb 21, 2024

This PR only implements a part of issue #4556, so please create a new issue and "Fixes it".

CloudEvent event = configuration.getEvent();
String topic = configuration.getTopic();
String consumerGroupName = configuration.getConsumerGroupName();
String retryTopicName = consumerGroupName + RetryMessageUtil.RETRY_GROUP_TOPIC_SUFFIX;
Copy link
Member

@pandaapo pandaapo Feb 21, 2024

Choose a reason for hiding this comment

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

I am not familiar with Pulsar, but I have two questions about your code:
1 Pulsar's message retry feature is turned off by default and needs to be turned on manually, how did you turn it on?
2 I don't understand how you realize that Pulsar automatically retries messages in the "xxx-RETRY" queue. Could you explain?
@HarshSawarkar

Copy link
Contributor Author

@HarshSawarkar HarshSawarkar Feb 24, 2024

Choose a reason for hiding this comment

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

Hi @pandaapo, @xwm1992 the retry feature is not turned on. For turning it on, can the retryAsynchronously(Supplier<CompletableFuture> supplier, Backoff backoff, ScheduledExecutorService scheduledExecutorService, CompletableFuture callback) method of RetryUtil class of pulsar-client-2.11.1.jar library be considered as it provides with the method scheduledExecutorService.execute() to schedule and execute a retry.
image
As in eventmesh-storage-RocketMQ the class ConsumeMessageConcurrentlyService has the implemenetation for retrying failed message of RocketMQ. Can you please guide?
image

Copy link
Member

Choose a reason for hiding this comment

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

@HarshSawarkar
RocketMQ can automatically retry messages in the "% RETRY%..."queue, so RocketMQRetryStrategyImpl utilizes RocketMQ's retry queue feature and sends failed messages to a queue with the prefix "% RETRY%".
When it comes to Pulsar, we also need Pulsar to automatically retry failed messages. Currently your code does not implement this feature.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could you provide some implementation ideas on how to implement the feature for automatically retrying failed messages of Pulsar?

Copy link
Member

Choose a reason for hiding this comment

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

@HarshSawarkar I wish I could give more useful help, but as I said earlier, I'm not familiar with Pulsar.

Copy link
Member

Choose a reason for hiding this comment

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

@HarshSawarkar This PR has hit a standstill. After reading the conversation, it appears that Pulsar doesn't have a built-in retry queue, so you'll need to resend the messages through EventMesh. You can achieve this using an in-memory queue and a timer.

Copy link
Member

Choose a reason for hiding this comment

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

you'll need to resend the messages through EventMesh. You can achieve this using an in-memory queue and a timer.

This suggestion is incorrect. Because the task of this PR is to implement retry in Pulsar without relying on EventMesh's memory. Otherwise, the PR would be redundant since EventMesh retries within the memory by default.

@Pil0tXia Pil0tXia changed the title [ISSUE #4556]Implemented retry strategy based on pulsar message middleware [ISSUE #4556] Implement retry strategy based on pulsar message middleware Apr 15, 2024
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.

[Enhancement] Implement retry strategy based on more message middleware
3 participants