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

CAMEL-20010 #11759

Merged
merged 3 commits into from
Oct 18, 2023
Merged

CAMEL-20010 #11759

merged 3 commits into from
Oct 18, 2023

Conversation

brunomendola
Copy link
Contributor

Description

Preserve default queries in JdbcMessageIdRepository to avoid replacing the table name more than once.

Solves CAMEL-20010.

Target

  • I checked that the commit is targeting the correct branch (note that Camel 3 uses camel-3.x, whereas Camel 4 uses the main branch)

Tracking

  • If this is a large change, bug fix, or code improvement, I checked there is a JIRA issue filed for the change (usually before you start working on it).

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 and I have committed all auto-generated changes

@github-actions
Copy link
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟

🤖 CI automation will test this PR automatically.

🐫 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.

  • ⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@essobedo
Copy link
Contributor

I'm wondering if it is normal that the JdbcMessageIdRepository is initialized several times which is maybe more the problem to fix, WDYT?

@davsclaus
Copy link
Contributor

doInit ensures its only invoked once

@davsclaus davsclaus merged commit 03369ce into apache:main Oct 18, 2023
3 checks passed
davsclaus pushed a commit that referenced this pull request Oct 18, 2023
* CAMEL-20010 Preserve default queries in JdbcMessageIdRepository to avoid replacing the table name more than once

* CAMEL-20010 Use String#replace instead of replaceFirst to avoid unnecessary usage of regular expressions

---------

Co-authored-by: Bruno Mendola <bruno.mendola@dedagroup.it>
davsclaus pushed a commit that referenced this pull request Oct 18, 2023
* CAMEL-20010 Preserve default queries in JdbcMessageIdRepository to avoid replacing the table name more than once

* CAMEL-20010 Use String#replace instead of replaceFirst to avoid unnecessary usage of regular expressions

---------

Co-authored-by: Bruno Mendola <bruno.mendola@dedagroup.it>
davsclaus pushed a commit that referenced this pull request Oct 18, 2023
* CAMEL-20010 Preserve default queries in JdbcMessageIdRepository to avoid replacing the table name more than once

* CAMEL-20010 Use String#replace instead of replaceFirst to avoid unnecessary usage of regular expressions

---------

Co-authored-by: Bruno Mendola <bruno.mendola@dedagroup.it>
davsclaus pushed a commit that referenced this pull request Oct 18, 2023
* CAMEL-20010 Preserve default queries in JdbcMessageIdRepository to avoid replacing the table name more than once

* CAMEL-20010 Use String#replace instead of replaceFirst to avoid unnecessary usage of regular expressions

---------

Co-authored-by: Bruno Mendola <bruno.mendola@dedagroup.it>
@essobedo
Copy link
Contributor

doInit ensures its only invoked once

So why do we get what is described in the ticket? I quote:

JdbcMessageIdRepository is designed to replace the CAMEL_MESSAGEPROCESSED substring in the queries with the custom table name in the onInit() function, but looks like this function is called multiple times and it keeps replacing the substring that is present also in the custom table name.

If I understand it well, if onInit() was called only once as it should, the problem would not occur

@brunomendola brunomendola deleted the CAMEL-20010 branch October 18, 2023 16:12
@brunomendola
Copy link
Contributor Author

doInit ensures its only invoked once

...

If I understand it well, if onInit() was called only once as it should, the problem would not occur

I think @essobedo has a point.

I mean... the replacement was clearly happening twice, but the onInit() function should not be invoked twice by Camel.

Maybe it's something related to some particular condition?
The fact that the idempotentRepository was a bean, could it produce some unexpected behavior? Maybe something about concurrency? Is the onInit() call synchronized in some way?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants