GitHub user tarilabs opened a pull request: https://github.com/apache/camel/pull/603
Producer no CQL Uri Param handling on doStart() Problem: - cql Uri param is not mandatory (default null) - prepareStatements Uri param default true Therefore creating a Producer like "cql://localhost/camel_ks" fails; also, the error returned is misleading. Details: With the above premises, the top of the stacktrace is "org.apache.camel.FailedToCreateProducerException: Failed to create Producer for endpoint: Endpoint[cql://localhost/camel_ks]. Reason: com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: localhost/127.0.0.1:9042 (com.datastax.driver.core.TransportException: [localhost/127.0.0.1:9042] Error writing))" However this actually: - is caused by the Producer doStart() trying to prepare a null cql statement - error looks like server/host is unreachable, but is actually the failure of trying to prepare a null statement Proposed solution: Modify the the Producer's doStart() to invoke the Endpoint's prepareStatement() method with additional condition that cql is not null. An additional unit test is provided to illustrate the scenario, for instance a component earlier in the route would provide the actual cql statement as part of the header, for example an EIP Translator. Therefore in this scenario the cql is not unique and cannot be configured in the Producer endpoint uri. Aditional Notes: On my machine maven test do fail on the master branch earlier than this modification, and this modification does not solve those problems. You can merge this pull request into a Git repository by running: $ git pull https://github.com/tarilabs/camel patch-producernocqluriparam Alternatively you can review and apply these changes as the patch at: https://github.com/apache/camel/pull/603.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #603 ---- commit a24565c66e7b9a8e788647bd3db1a91538591fbd Author: tarilabs <matteo.mort...@gmail.com> Date: 2015-08-31T10:09:11Z Producer no CQL Uri Param handling on doStart() Problem: - cql Uri param is not mandatory (default null) - prepareStatements Uri param default true Therefore creating a Producer like "cql://localhost/camel_ks" fails; also, the error returned is misleading. Details: With the above premises, the top of the stacktrace is "org.apache.camel.FailedToCreateProducerException: Failed to create Producer for endpoint: Endpoint[cql://localhost/camel_ks]. Reason: com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: localhost/127.0.0.1:9042 (com.datastax.driver.core.TransportException: [localhost/127.0.0.1:9042] Error writing))" However this actually: - is caused by the Producer doStart() trying to prepare a null cql statement - error looks like server/host is unreachable, but is actually the failure of trying to prepare a null statement Proposed solution: Modify the the Producer's doStart() to invoke the Endpoint's prepareStatement() method with additional condition that cql is not null. An additional unit test is provided to illustrate the scenario, for instance a component earlier in the route would provide the actual cql statement as part of the header, for example an EIP Translator. Therefore in this scenario the cql is not unique and cannot be configured in the Producer endpoint uri. Aditional Notes: On my machine maven test do fail on the master branch earlier than this modification, and this modification does not solve those problems. ---- --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---