KaotoIO / kaoto

The UI of the Kaoto project
https://kaoto.io
Apache License 2.0
29 stars 23 forks source link

Support Bean Reference : Camel Route #467

Open igarashitm opened 9 months ago

igarashitm commented 9 months ago

Please describe the feature that you want to propose

For example when a user is configuring a SQL step, they needs to configure a DataSource bean

- beans:
    - name: 'dataSource'
      type: 'org.postgresql.ds.PGSimpleDataSource'
      properties:
        serverName: '127.0.0.1'
        portNumber: '5432'
        databaseName: 'dvdrental'
        user: 'postgres'
        password: 'pgsql'

- from:
    uri: 'netty-http:http://0.0.0.0:8080'
    steps:
      - to:
          uri: 'sql:select * from actor'
          parameters:
            dataSource: '#dataSource'

Note that the dataSource parameter has just a bean reference #dataSource, referencing a bean defined in the beans

We should support this usecase at least in 2 ways - in the step configuration form, on the dataSource parameter :

  1. User can get a list of existing beans those are compatible with javax.sql.DataSource, and when one of them is chosen, the dataSource parameter is filled with a reference to that bean
    • How does Kaoto know org.postgresql.ds.PGSimpleDataSource is an implementation of javax.sql.DataSource? this is Java knowledge, need hints from outside - i.e. vscode host
      1. User can create a new bean entry directly from SQL step configuration form, for example by showing a pop-up mini form to create a new DataSource bean, then fill the dataSource parameter with a reference

As a 1st iteration, we might just add a basic capability without looking into Java type

  1. List all visible beans in dropdown and fill the reference once chosen
  2. Allow creating a bean from step configuration form, Java type FQCN needs to be typed by the user

Then consider the Java type handling in 2nd iteration.

igarashitm commented 7 months ago

No. 1 was implemented with - https://github.com/KaotoIO/kaoto-next/issues/470 Java type of the beans is not taken into account yet.