Uploaded image for project: 'Red Hat Build of Apache Camel for Quarkus'
  1. Red Hat Build of Apache Camel for Quarkus
  2. CEQ-9590

The used datasource varies randomly if there are multiple datasource settings in application.properties with camel-sql

XMLWordPrintable

    • False
    • Hide

      None

      Show
      None
    • False
    • 0
    • +

      • The used datasource varies randomly if there are multiple datasource settings in application.properties with camel-sql
            - For exmalple, default datasource and "sub" detasource are defined in the the following application.properties.
            - In this case, the used datasource varies randomly each time Camel is started, e.g. sometimes the default datasource is used, other times the "sub" datasource is used, etc.
            - My opinion is that the default datasource should always be used. This problem does not occur in the Red Hat build of Apache Camel 4.0.
      • # application.properties
        quarkus.datasource.db-kind=postgresql
        quarkus.datasource.username=ceq-test
        quarkus.datasource.password=ceq-test
        quarkus.datasource.jdbc.url=jdbc:postgresql://localhost:5432/ceq01
        
        quarkus.datasource."sub".db-kind=postgresql
        quarkus.datasource."sub".username=ceq-test
        quarkus.datasource."sub".password=ceq-test
        quarkus.datasource."sub".jdbc.url=$jdbc:postgresql://localhost:5432/ceq02
        
        # camel-sql route definition
            .to("sql:classpath:sql/example.sql&outputType=SelectOne"
         

      Environment

      • Red Hat Build of Apache Camel for Quarkus 4.4
            - quarkus.platform.version: 3.8.5.redhat-00003

      Workaround

      Assign a name, e.g. 'main', to the default data source. And use it in the dataSource option in camel-sql.

      
      # Default data source config
      quarkus.datasource."main".db-kind=postgresql
      
      # Additional datasource config
      quarkus.datasource."sub".db-kind=postgresql
      
      Then in the route, use the dataSource option:
      .to("sql:classpath:sql/example.sql?dataSource=#main")
       

      This problem is caused by the following

      The following ticket in upstream is to resolve the issue

              zfeng@redhat.com Zheng Feng
              rhn-support-tyamashi Tomonari Yamashita
              Andrej Vano Andrej Vano
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: