liunaijie commented on issue #8576:
URL: https://github.com/apache/seatunnel/issues/8576#issuecomment-2608764330

   > +1 from proposal1. About proposal2, could you share more details about 
`Move the connector creation logic from Connector to ConnectorFactory.`? What 
it would be look like?
   
   About proposal2
   now some connector implement the `TableSourceFactory`, but they not 
implement `createSource` method. so we still has 2 way to create the 
`Connector` instance.
   - one is use `tableSourceFactory.createSource/Sink()` it return the 
connector instance.
   - one is use `ServiceLoader.load` to load all implement and use 
`pluginIdentifier` to find the connector instance.
   
   So I suggest we unified the behavior, implement the `createSource/Sink` 
method. use `Factory` to create the connector instance. 
   
   
   ```
       private static boolean isFallback(Optional<Factory> factory) {
           if (!factory.isPresent()) {
               return true;
           }
           try {
               ((TableSourceFactory) factory.get()).createSource(null);
           } catch (Exception e) {
               if (e instanceof UnsupportedOperationException
                       && "The Factory has not been implemented and the 
deprecated Plugin will be used."
                               .equals(e.getMessage())) {
                   return true;
               }
           }
           return false;
       }
   ```
   


-- 
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: commits-unsubscr...@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to