camel icon indicating copy to clipboard operation
camel copied to clipboard

Salesforce component: removed initial replay id check

Open lorenzobenvenuti opened this issue 6 months ago • 1 comments

Description

See https://issues.apache.org/jira/browse/CAMEL-22173

Target

  • [ ] I checked that the commit is targeting the correct branch (Camel 4 uses the main branch)

For now the MR is targeting 4.10.x because it's easier for me to test the fix in our app

Tracking

  • [x] If this is a large change, bug fix, or code improvement, I checked there is a [JIRA issue]

https://issues.apache.org/jira/browse/CAMEL-22173

Apache Camel coding standards and style

  • [ ] I checked that each commit in the pull request has a meaningful subject line and body.

  • [ ] I have run mvn clean install -DskipTests locally from root folder and I have committed all auto-generated changes.

lorenzobenvenuti avatar Jun 18 '25 12:06 lorenzobenvenuti

:star2: Thank you for your contribution to the Apache Camel project! :star2:

:robot: CI automation will test this PR automatically.

:camel: Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run

  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot.

  • You can label PRs using build-all, build-dependents, skip-tests and test-dependents to fine-tune the checks executed by this PR.

  • Build and test logs are available in the Summary page. Only Apache Camel committers have access to the summary.

  • :warning: Be careful when sharing logs. Review their contents before sharing them publicly.

github-actions[bot] avatar Jun 18 '25 12:06 github-actions[bot]

There is a bit of TODO in this code. The old option can be marked as @Deprecated at first for older releases. The code that stops the route is also debateable as no other components does that. Its better to let the route keep erroring as its not possible to subscribe to that topic. So maybe log a WARN instead.

davsclaus avatar Jul 03 '25 05:07 davsclaus

Thanks for your feedback! As I mentioned in the Jira US, I had a few ideas about how to handle errors without stopping the route. I've pushed some changes with the second option: if the replay id is invalid, when fallbackToLatestReplayId is set then the consumer re-subscribes using ReplayPreset.LATEST; otherwise, an exception is passed to the consumer ExceptionHandler and no other action is taken. This means that the consumer will retry to subscribe with the same id and it will likely receive other errors, but if users want to stop the route they can plug a BridgeExceptionHandlerToErrorHandler and handle an InvalidReplayIdException in the route exception handler. LMK your thoughts. Meanwhile, I'll try to implement a couple of integration tests.

Thanks,

lorenzo

lorenzobenvenuti avatar Jul 03 '25 07:07 lorenzobenvenuti

Thanks, it would be great if you can get this done today/tomorrow as we cut Camel 4.13 in the weekend and it would be good to get this included in that release.

davsclaus avatar Jul 03 '25 07:07 davsclaus

I've added a couple of integration tests and moved the fallbackToLatestReplayId to the endpoint (I thought it was a better option in case someone has multiple subscribers and wants to configure different behaviors); as mentioned earlier, this branch comes from camel-4.10.x because that's what we're using and I wanted to be able to test the changes in our application without introducing other variables, but if you think that the code looks good I'll rebase the MR and target main. Thanks!

lorenzobenvenuti avatar Jul 03 '25 10:07 lorenzobenvenuti

Just some small things. Yeah the code looks good. You are welcome to target main branch either as new PR or change this

davsclaus avatar Jul 03 '25 11:07 davsclaus

I've updated the PR, using main as the target branch, and addressed the comments. Thanks!

lorenzobenvenuti avatar Jul 03 '25 15:07 lorenzobenvenuti

/component-test camel-salesforce

Result :white_check_mark: The tests passed successfully

davsclaus avatar Jul 03 '25 15:07 davsclaus

:robot: The Apache Camel test robot will run the tests for you :+1:

github-actions[bot] avatar Jul 03 '25 15:07 github-actions[bot]