lsergio opened a new pull request, #21142:
URL: https://github.com/apache/camel/pull/21142

   …uired properties
   
   # Description
   
   This is a proposal to alter SqlServiceLocationHelper so that it only queries 
the properties that it might use instead of getting them all into a Properties 
object and reading them afterwards.
   
   Why the proposal?
   
   We faced an issue where we are using Apache Commons DBCP 
[BasicDataSource](https://github.com/apache/commons-dbcp/blob/master/src/main/java/org/apache/commons/dbcp2/BasicDataSource.java#L1090).
 During the sql component initialization phase, it would get the properties 
from that class, which includes `getLogWriter()`.
   
   This method creates a real connection to the database which is not needed 
for the purposes of service location, as it is interested only in jdbc url and 
username.
   
   And it got worse in a scenario where an Azure MySQL Database was stopped. 
Each connection attempt was taking 2+ minutes to finish as no timeout was 
configured in the connection url. Having a few sql endpoints on my route caused 
the camel context to take more than 10 minutes to start.
   
   We fixed this by setting `serviceLocationEnabled` to `false` in the 
component, but I think that avoiding this unnecessary connection is helpful.
   
   If this is ok and we need a Jira ticket, let me know and I can amend the 
commit adding a reference to it.
   
   # Target
   
   - [ ] I checked that the commit is targeting the correct branch (Camel 4 
uses the `main` branch)
   
   # 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) filed for 
the change (usually before you start working on it).
   
   <!--
   # *Note*: trivial changes like, typos, minor documentation fixes and other 
small items do not require a JIRA issue. In this case your pull request should 
address just this issue, without pulling in other changes.
   -->
   
   # Apache Camel coding standards and style
   
   - [X] I checked that each commit in the pull request has a meaningful 
subject line and body.
   
   <!--
   If you're unsure, you can format the pull request title like `[CAMEL-XXX] 
Fixes bug in camel-file component`, where you replace `CAMEL-XXX` with the 
appropriate JIRA issue.
   -->
   
   - [ ] I have run `mvn clean install -DskipTests` locally from root folder 
and I have committed all auto-generated changes.
   
   <!--
   You can run the aforementioned command in your module so that the build 
auto-formats your code. This will also be verified as part of the checks and 
your PR may be rejected if if there are uncommited changes after running `mvn 
clean install -DskipTests`.
   
   You can learn more about the contribution guidelines at 
https://github.com/apache/camel/blob/main/CONTRIBUTING.md
   -->
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to